The Church of Scotland has voted to allow the ordination of openly gay ministers but only after an emotional debate and pleas by traditionalists from all over the country to reject the move.

The General Assembly's final say in the historic change to Church law brought a muted response from the floor after more than two hours of debate.

The assembly saw 488 vote, and the church voted in favour of openly gay ministers 309-182

It means allowing actively gay ministers in congregations who support the move in a "mixed economy" policy.

The Kirk said 21 out of 806 ministers have left the Kirk over the possibility of the Church agreeing to allow individual congregations to choose a gay minister.

The ordaining of ministers in same-sex relationships has divided the Church since traditionalist members attempted to block the appointment of Rev Scott Rennie, who is in a civil partnership, in Aberdeen in 2009.

This issue will be followed up on Thursday should the move be voted through, with the assembly being asked to include ministers in same-sex marriages in Church law.

Moderator Angus Morrison called for "moments of reflection".

During the annual gathering of the Church of Scotland, which has met almost every year since its inception in 1560, 730 commissioners drawn from congregations across Scotland and beyond will make historic decisions that will affect the direction of the national church.