The Scottish Episcopal Church (SEC) has voted to approve same-sex church marriages in a historic vote.
It makes them the first Anglican church in the UK to allow gay and lesbian marriages.
Members of the church's General Synod in Edinburgh agreed to change cannon law at their annual meeting on Thursday.
However they said clergy who do not wish to carry out same-sex weddings will not be forced to do so "against their conscience".
Equal-rights campaigners were quick to welcome the decision.
However, the Secretary General of the Anglican Communion, Archbishop Josiah Idowu-Fearon, said the vote puts the Scottish Episcopal Church at odds with the majority stance within the Anglican Communion.
In approving the proposal, church members voted to remove the doctrinal clause which stated that marriage is a "union of one man and one woman".
It was replaced with a "conscience clause" which states: "In the light of the fact that there are differing understandings of the nature of marriage in this church, no cleric of this church shall be obliged to conduct any marriage against their conscience."
The proposal was passed with 80% support from the Bishops and Laity, while 67% of the Clergy backed the move.
Same-sex weddings could be held within the church by the autumn of this year, reports have suggested.
The Scottish Episcopal Church is Scotland's third largest church, and had over 54,000 ergistered members.