The General Assembly of the Church of Scotland has rejected an attempt to block the appointment of an openly gay minister.
The Kirk's ruling body voted by 326 to 267 in support of the Reverend Scott Rennie after more than four hours of debate.
37-year-old Mr Rennie had the support of the majority of his congregation and presbytery at Queen's Cross Church in Aberdeen - but the move to appoint him sparked strong protest from traditionalist members.
The Kirk would not comment on the decision, other than to confirm the outcome of the vote.
About 900 elders and ministers took part in the session, which got under way at 6.30pm yesterday evening, but not everyone cast their electronic vote.
Demonstrators from both sides had gathered earlier outside the Kirk building, on The Mound in Edinburgh, peaking at about 60 people during the day.