The Church of Scotland has voted to allow clergy to conduct same-sex marriages for the first time.
Members of the General Assembly in Edinburgh voted to change church law following years of campaigning.
It means same-sex couples will be able to marry in church in services conducted by ministers.
Ministers and deacons will be able to apply to become celebrants of same sex marriage, but they will not be forced to take part.
The results of the vote were: 274 for and 136 against.
Rt Rev Dr Iain Greenshields, moderator of the General Assembly, said: "The Church of Scotland is a broad church and there are diverse views on the subject of same-sex marriage among its members.
"There has been a lengthy, prayerful and in-depth discussion and debate about this topic for many years at all levels of the Church to find a solution that respects diversity and values the beliefs of all.
"The Church is committed to ensuring that debates on this subject are held in a spirit of humility and grace, the tone and tenor of discussions are civil and people are respectful of those who hold opposing views."
'Support the deliverance'
Before Monday's vote, members of the assembly expressed a range of opinions on the change.
Among them was Rev Scott Rennie, who in 2009 became the first openly gay clergyman in the Church of Scotland to have his appointment approved - despite protests by some sections of the Kirk.
He was not able to marry his husband in a religious ceremony, as he would have wanted.
He told the General Assembly: "I sincerely hope the assembly will find it in itself to support the deliverance, even those who have their doubt."