The Scottish Government said it plans to legalise same-sex marriage, with Deputy First Minister Nicola Sturgeon insisting the controversial move is the “right thing to do”.
Nearly two-thirds of all people in Scotland who responded to a consultation on the issue said they are against the change and many religious groups, including the Catholic Church and the Church of Scotland, are bitterly opposed to it.
Ms Sturgeon insisted churches, and individuals within them, would not have to conduct same-sex marriages if they do not agree with them.
The decision to change the law to allow gay couples to marry, rather than enter a civil partnership (as they can do currently), comes after almost 80,000 people responded to the Scottish Government 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.
"However, we recognise and respect the concerns that some people have expressed, in particular the concerns that have been expressed by the churches, and we're determined the legislation we bring forward will be accompanied by protection for freedom of speech and freedom of religion."
There were 77,508 responses to the consultation, with 375 from organisations and the rest from individuals. A total of 81% of responses were from people living in Scotland. Of those, 36% are in favour of same-sex marriage and 64% were against. But when responses, such as postcards and petitions, are not considered, 65% are in favour and 35% are against.
Ms Sturgeon said the result of the consultation was just one of the factors the Government considered when reaching its decision. Ministers also took into account the support for gay marriage from the leaders of all the other main political parties in Scotland.
There appears to be "significant parliamentary support" for the change although the SNP, which has a majority in the Scottish Parliament, will give its MSPs a free vote, she said.
The Scottish Government now intends to have a "focused consultation" with a number of interested parties before drafting the legislation. This will allow ministers to consider what other possible protection can be included, "to give reassurance to those who have expressed concerns", Ms Sturgeon added.
Draft legislation should then be published by the end of the year, on which further consultation would be held.
The Scottish Government is also holding talks with the Home Office as ministers at Holyrood believe an amendment is needed to UK equalities legislation to protect individual celebrants who do not want to conduct same-sex ceremonies, even if their church, as an organisation, backs them.
The Scottish Government is working "very constructively" with Westminster on this, Ms Sturgeon said.
"The UK Government has indicated in principle any amendments that require to be made will be made.
"It is our intention to secure the agreement for such an amendment before we formally introduce the Bill to Parliament and then have such an amendment enacted before an Act of the Scottish Parliament took force."
She said she does not believe that agreeing an amendment to the Equality Act would "require to be a lengthy process".
If the legislation is introduced in 2013, as planned, the first same-sex marriages could take place at the start of 2015.
Ms Sturgeon said the legislation will "allow churches to conduct same-sex marriages if they so wish", adding that this would be done on an opt-in basis rather than an opt-out basis.
"This is a controversial issue, there is no getting away from that. There are very deeply held views on both sides of the debate and it is not possible to completely reconcile those different views. But as we proceed on this issue, the Scottish Government will continue to be respectful of differences of opinion and we will strive to address concerns that have been expressed by those who take a different view."
Commitments the Scottish Government has already given, that no church and no religious celebrant would be compelled to conduct same-sex marriages, will be honoured in full, she said.
"The role of the state is to regulate the civil contract of marriage. It's not to tell churches who they should and shouldn't marry."
The Catholic Education Service determines the faith content of the curriculum in Catholic schools, and would continue to do this, Ms Sturgeon said.
"What we are introducing, in terms of same-sex marriage, will not change that.
"Although, as a government, we will be introducing legislation to allow loving same-sex couples to commit to each other in marriage because we believe that is the right thing to do in a modern society, it is not our intention to trample over anybody's freedom of speech or freedom of conscience or freedom of religion."
The UK Government has also carried out a consultation on same-sex marriage in England and Wales, and has said it will publish the result of that by the end of the year.
The proposals, backed by Prime Minister David Cameron, envisage same-sex civil marriage ceremonies in a register office or approved premises but no change to religious marriages which can only currently take place between a man and a woman.
But Deputy Prime Minister Nick Clegg has said churches and other religious premises should be allowed to host gay weddings.
A Home Office spokesman said it is "working closely with the Scottish Government to consider what specific changes to the Equality Act, or other legislation, could be needed", adding that "if changes are needed, they will be made".
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies