LGBT Christians are celebrating after the Scottish Episcopal Church today voted to allow same-sex couples to marry in church.
It becomes the first UK Anglican church to change canon law regarding marriage, which currently describes it as a union between a man and a woman.
The result from the General Synod in Edinburgh, which came shortly after 4:50pm, followed hours of speeches and months of discussions among laity, bishops, and clergy in Scotland's third-largest church.
After the debate, members prayed together as votes were counted.
At least a two-thirds majority was needed among all three groups to pass the motion to amend Canon 31 Section 1, which contains the existing definition of marriage.
In practice, the results far exceeded the minimum, with 80% of bishops voting in favour, 80.6% of laity, and 67.7% of clergy.
The motion also contained a "conscience clause" meaning that any clergy or church that did not wish to conduct same-sex weddings would not have to.
The historic vote by the church was welcomed by Rev. Scott Rennie, the first married, gay minister in the Church of Scotland, who told BuzzFeed News: "I and many other ministers and members of the Church of Scotland will want to congratulate the Scottish Episcopal Church today in their historic vote which affirms marriage and recognises God’s blessing in the lives of LGBT people in Scotland."
He added: "They have shown leadership to sister churches in these islands, not least in their own Anglican Communion. I look forward to the day when we in the Church of Scotland are also able to, with our Episcopal sisters and brothers, conduct marriages, no matter the gender of those who live in love and commitment. Love is love."
Colin Macfarlane, director of Stonewall Scotland, said: "We’re delighted by today’s news from the Scottish Episcopal Church. This step allows same-sex couples to celebrate their love within their faith and sends a really positive message to other LGBT people, both here and around the world. It signals that members of the church welcome, recognise, and respect LGBT people as part of the faith community."
In 2016, the church's synod agreed to put the issue of same-sex marriages to its seven dioceses for discussion, prompting six of them to support it. Only Aberdeen and Orkney opposed changing the church's stance.
At the time, the archbishop of Canterbury refused to comment, but Archbishop Josiah Idowu-Fearon, the secretary-general of the Anglican Communion, said: "There are differing views within the Anglican Communion but the majority one is that marriage is the lifelong union of a man and woman."
Just as the result today to allow gay weddings was expected, the ramifications will also likely be predictable. A backlash from the worldwide Anglican Communion is probable, as last year it imposed sanctions on the US Episcopal Church for approving gay weddings in church.
But it is also likely that there will be intensifying pressure on other Scottish and Anglican denominations to follow suit.
The Church of Scotland (which is Presbyterian rather than Episcopalian) last month approved the process of consideration of same-sex weddings, the most important stage of which would be a vote by the general assembly next year. Even if that passes, it could be several years before weddings are conducted.
But as well as triggering the process, the church passed a motion instructing its leaders to "apologise individually and corporately" to gay people for its "history of discrimination" and to "seek to do better".
Same-sex marriage became legal in Scotland in 2014, shortly after England and Wales, however the Church of Scotland and the Catholic church opposed it, while the Westminster government included in legislation measures that made it illegal for the Church of England to hold same-sex weddings.
The issue of homosexuality, and in particular gay clergy and same-sex marriage, has become the prime source of tension within the worldwide Anglican Communion, despite the Bible containing no mention of what Jesus thought about love between two members of the same sex.
A schism surrounding the subject, formed over several decades, has only widened in recent years as some US and western European branches of Anglicanism embrace liberal interpretations of scripture, while many within the rest of the world retain traditional teachings.