Announcing the Scottish Government will introduce legislation that could see the first same-sex marriages take place at the start of 2015, Nicola Sturgeon, Scotland's Deputy First Minister, said legalising gay marriage was the "right thing to do".
While the Holyrood administration insists protections will be included in the new law to ensure churches, and individuals within them, do not have to conduct same-sex marriages if they do not agree with them, many religious leaders hit out at the decision.
A spokesman for the Catholic Church in Scotland said: "The Scottish Government is embarking on a dangerous social experiment on a massive scale."
Campaign group Scotland For Marriage condemned the "ill-conceived and poorly thought out" plan as it is being brought in "with no consideration for the views of the vast majority in the country". But it is certain to be passed into law by a large majority.
However, the decision was hailed by equality campaigners as a proud day for Scotland.
While the UK Government has also carried out a consultation on same-sex marriage, it has yet to publish the result. But the proposals for England and Wales, backed by Prime Minister David Cameron, envisage same-sex civil-marriage ceremonies in a registry office or approved premises, and no change to religious marriages.
The consultation on the proposals in Scotland produced 77,508 responses including postcards, pro forma letters and petitions, with a ratio of 64% to 36% against reform. Almost one-fifth of these came from outwith Scotland. When postcards, campaign letters and petitions were put aside, the counting of conventional consultations turned the result on its head, with 65% in support and 35% opposed.
Ms Sturgeon said she would now embark on a further consultation with interested parties.
This would lead to a draft Bill published by the end of the year which would go out to consultation.
Ms Sturgeon said: "It is the intention of the Scottish Government to bring forward legislation to legalise same-sex marriage. We believe that in a country that aspires to be an equal and tolerant society, as we do in Scotland, then this is the right thing to do."
The move was welcomed with varying degrees of enthusiasm by all the parties at Holyrood but most mainstream faith groups expressed dismay or anger.
A spokesman for the Catholic Church in Scotland said: "We strongly suspect that time will show the Church to have been completely correct in explaining that same-sex sexual relationships are detrimental to any love expressed within profound friendships."
Ms Sturgeon said that, although the Cabinet decision was unanimous, the SNP would operate a free vote on this as an issue of conscience. Some prominent junior ministers could therefore vote against or abstain, such as deputy Justice Minister Roseanna Cunningham, a practising Catholic, Chief Whip Brian Adam, a Mormon, Energy Minister Fergus Ewing, who is seen by some as a social conservative, and junior Education Minister Alasdair Allan, who could face constituency problems in the Western Isles.
Although Ms Sturgeon said churches and faith groups were already given full protection under schedule 23 of the existing UK Equalities Act should they wish not to take part in same-sex ceremonies, there is a question mark over dissenting clerics within churches that have opted to participate.
To protect their right of conscience, a small amendment to the UK Act would be needed and Ms Sturgeon said the Home Office has expressed willingness to co-operate.
The Equality Network and Scottish Youth Parliament, who championed the reform, welcomed the news, calling it a proud day for Scotland.
The STUC, National Union of Students and the Human Rights Commission all added their support.
The Rev Alan Hamilton, convener of the Church of Scotland Legal Questions Committee, said: "The Church is taking time to carefully consider the important issues. Our Theological Commission will report in May 2013. However, we are concerned the Scottish Government is rushing ahead on something that affects all the people of Scotland without adequate debate."
But the Free Church reacted bitterly, saying: "With the Scottish Government riding roughshod over the clear opposition to same-sex marriage expressed within the consultation, the whole exercise has been completely meaningless."