document: The historic vote on the first day of this year's gathering in Edinburgh draws a line under a row which has split the Kirk for nine years.
  Commissioners voted by 339 votes to 215 in favour of the move.
  The decision means that same sex civil marriage will be permitted for ministers.
  However, they will not themselves be allowed to conduct gay weddings within the church.
  Last year, the assembly agreed that ministers could enter into civil partnerships.
  The Very Rev John Chalmers, principal clerk to the General Assembly, said: "We had a debate which made very clear that we were not interfering with our theological definition of marriage and were not going to the place where ministers or deacons could themselves be conducting same-sex marriages.
  "It is an entirely different discussion.
  "Today's decision means it will be possible for Kirk sessions and congregations to depart from the traditional understanding of marriage to call not only potentially a minister in a civil partnership but one who is in a same-sex marriage.
  "In some ways we crossed the Rubicon last year when it was agreed that Kirk sessions could call someone in a civil partnership and for many people what today was about was simply tidying up and making the law of the church consistent with Scots law."
  He added: "Today I think people came to this decision with their minds on law and practice and not on theology and future practice."
  Colin Macfarlane, director of charity Stonewall Scotland, said: "Today's result is great news for the Kirk and a progressive move forward.
  "Empowering ministers to live their lives with honesty and integrity sends a powerful signal to faith communities and society as a whole."
  Rev David Robertson, Moderator of the Free Church of Scotland, said it was "saddened" by the decision.
  The decision means the Kirk adopts a position which maintains a traditional view of marriage between a man and woman, but allows individual congregations to "opt out" if they wish to appoint a minister or a deacon in a same-sex marriage or a civil partnership.
  Any wider consideration of the theological understanding of same-sex marriage will not take place until the Theological Forum presents its report to the Kirk next year.
  These latest changes will differentiate the church from the Church of England, which bans clergy from being married to partners of the same sex and does not allow gay church weddings.
  Other topics to be discussed at the six-day assembly include the European Union referendum, corporal punishment of children, climate change and the refugee crisis.
  Members will also discuss exploring ways of promoting the Church through the internet and social media, including a proposal to develop online congregations.
  The assembly will also consider changing the date of the gathering to June to allow more young people to attend without disrupting their exams.
  On Wednesday the Archbishop of Canterbury will become the first head of the Church of England to take part in a debate at the general assembly.
  The Most Reverend Justin Welby will speak to a landmark report, which proposes that the two denominations enter into a historic ecumenical partnership.
  At the General Synod in London in February the Moderator of the General Assembly of the Church of Scotland, the Right Rev Dr Angus Morrison, took part in a debate on the Columba Declaration which formally approved the agreement.
  Dr Morrison said: "We all look forward to welcoming the Archbishop of Canterbury to the General Assembly on Wednesday to speak to the historic Columba Declaration.
  "It was my privilege to address the General Synod of the Church of England on the same document and by a very large majority the Synod affirmed it.
  "I am confident that our General Assembly will do so too.
  "In itself, the declaration is largely of a symbolic nature but it does pave the way for our further growth in fellowship and for extending partnership in mission as sister and national churches who share many common roots, challenges and opportunities."
  Former Archbishop of Canterbury Dr Rowan Williams addressed the General Assembly in 2012 but did not take part in a debate.
  First Minister Nicola Sturgeon attended the formal opening ceremony in the building on the Mound which used to be home to the Scottish Parliament until 2004.
  More than 850 commissioners from across Scotland, the rest of the UK, Africa, Asia, North America, Europe, the Middle East and the Caribbean have registered to attend.
  Dr Morrison is to stand down from his 12-month role as moderator and will be replaced by the Rev Dr Russell Barr, the founder of Edinburgh-based homelessness charity, Fresh Start.
  Dr Barr has announced his intention to use his year in office to highlight the plight of homelessness in Scotland.
  Speaking after he was elected, the 62-year-old, who is minister at Cramond Kirk in Edinburgh, said he was "excited, honoured and overwhelmed".
  The Assembly was first held in 1560, the year of the Scottish Reformation which marked the beginning of the Protestant Church of Scotland.
summary: The General Assembly of the Church of Scotland has voted to allow ministers to continue to serve if they are in a gay marriage.