The General Assembly of the Church of Scotland has approved an apology to gay people for the history of discrimination they have faced in the Church.
The assembly also approved a report which could pave the way to allow some ministers to conduct same sex marriages in the future. The Church is to research legal protection for ministers and deacons who refuse to officiate ceremonies as a matter of conscience.
Commissioners also agreed that the Church should take stock of its history of discrimination against gay people, at different levels and in different ways, and apologise 'individually, corporately and seek to do better'.
The decisions were taken after three hours of impassioned debate over options presented by the Church's Theological Forum.
The debate was carried out in a spirit of grace and humility, but according to the Church, there was no mistaking the strength of feeling expressed in the hall.
Some commissioners on the traditionalist wing of the Church claimed the report by the Theological Forum was 'biased' and 'one-sided'.
Presenting the report, Theological Forum convener, Very Rev Professor Iain Torrance, said he and his colleagues could see 'no sufficient theological reason for the Church not to authorise specific ministers to officiate at same-sex weddings'.
He added that this would be possible 'if doing so does not prejudice the position of those who decline to do so for reasons of conscience'
He said the Forum was trying to frame the argument on same-sex marriage in a new way, drawing on the work of theologian Robert Song. Torrance said: 'Song suggests that rather than the old fraught polarisation of heterosexual versus homosexual, where the notion of homosexuality is demonised as disobedient to a creation expectation to pro-create, it needs to be reframed.'
Speaking after the debate, Rev Scott Rennie, minister at Queen's Cross Church in Aberdeen, said he was 'delighted' that the General Assembly had decided to move forward on the issue.
'There was a real feeling that we have to find space for everyone in the Church and I hope it is not too many years before I am able to marry people of the same gender,' he added.
But Rev Mike Goss, clerk of Angus Presbytery who has been representing the traditionalist wing of the Church in media interviews this week, said he and his colleagues were 'frustrated' that the Church was not coming together over the issue.
'Although there were things in the report that myself and friends felt could have been better expressed, it has not altered where things are with this debate,' he added.
'I hope that by having it today, we have highlighted that we do not feel that our position has been well reflected in the report itself and that will help the Church know where we are coming from.'
Mr Goss said he had 'no difficulty apologising' to the gay community.
'If I have caused hurt to other folk unintentionally then I am more than happy to do it,' he added.