The Church of Scotland has voted in favour of allowing people in same sex civil partnerships to be called as ministers and deacons.
The decision was made by the General Assembly on the Mound in Edinburgh today, where the motion was passed by 309 votes in favour and 182 against.
The outcome is the culmination of years of deliberation within the Church.
The motion has faced a series of debates and votes before the final decision was arrived at this afternoon.
This included 31 of the Church's presbyteries endorsing the move to 14 who opposed it.
It means the Church has adopted 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 civil partnership.
In a speech later today, the outgoing Moderator Very Rev John Chalmers is expected to say: "We cannot go on suffering the pain of internal attacks which are designed to undermine the work or the place of others. It's time to play for the team.
"And let me be very clear here - I am not speaking to one side or another of the theological spectrum. I am speaking to both ends and middle.
"It is time to stop calling each other names, time to shun the idea that we should define ourselves by our differences and instead define ourselves by what we hold in common - our baptism into Christ, our dependence on God's grace, our will to serve the poor and so on."
Co-ordinator of the Principal Clerk's office, Very Rev David Arnott, said: "The General Assembly of the Church of Scotland decided today to allow individual Kirk Sessions the possibility of allowing a nominating Committee to consider an application from a minister living in a civil partnership.
"During a vacancy a Kirk Session may, but only if it so wishes, and after due deliberation, agree to a Nominating Committee accepting an application from such a minister. No Kirk Session may be coerced into doing so against its own wishes. This decision was in line with a majority of presbyteries who voted in favour of such a move."
Because the debate predates the legalisation of gay marriage the proposed change mentions only civil partnerships, not same-sex marriages.
The Assembly will be asked on Thursday to consider amending today's new Church law to include ministers in same-sex marriages.