Image caption The Scottish government decision came after a consultation on gay marriage

Scotland could become the first part of the UK to introduce gay marriage after the SNP government announced plans to make the change.

Ministers confirmed they would bring forward a bill on the issue, indicating the earliest ceremonies could take place by the start of 2015.

Political leaders, equality organisations and some faith groups welcomed introducing same-sex marriage.

But it was strongly opposed by the Catholic Church and Church of Scotland.

The announcement was made in the wake of a government consultation which produced a record 77,508 responses.

Same-sex couples in Scotland currently have the option to enter into civil partnerships and the Holyrood government has insisted no part of the religious community would be forced to hold same-sex weddings in churches.

The Scottish government said;

it would work with UK ministers to amend equality laws to protect celebrants from legal or disciplinary action if they refuse to take part or speak out against same-sex ceremonies.

a bill would be brought forward to the Scottish Parliament later this year to bring in the change.

Scotland's deputy first minister, Nicola Sturgeon, said: "We are committed to a Scotland that is fair and equal and that is why we intend to proceed with plans to allow same-sex marriage and religious ceremonies for civil partnerships - we believe that this is the right thing to do.

Analysis Same sex marriages will not be conducted in Scotland before 2015. Scotland's deputy first minister, Nicola Sturgeon, has confirmed that the start of that year is the earliest new legislation would take effect. That could bring the Scottish government's timetable into line with UK government plans to change the law in England and Wales. Ms Sturgeon said it was "entirely feasible and entirely conceivable" that legislation would be going through the Scottish and UK parliaments at roughly the same time. The UK government's consultation on allowing civil marriages for gay and lesbian couples closed in June 2012. The coalition is analysing the results before publishing its formal response but Prime Minster, David Cameron, has promised legislation before the next election. The Scottish government's plans go further. It wants to allow both civil and religious ceremonies, with opt-outs for religious organisations that do not support same sex marriage. Ms Sturgeon said changes to the UK Equality Act are needed for Scottish legislation to be effective. The Home Office said: "If changes are needed, they will be made." It may be the ministry regards passage of its own legislation on same sex marriage as the most convenient way to do this. If reform happens in Scotland at the same time as in England and Wales, it will allow the Scottish and UK governments to lean on each other in responding to criticism. There are no plans to allow same sex couple to marry in Northern Ireland.

She went on: "The Scottish government has already made clear that no religious body will be compelled to conduct same-sex marriages and we reiterate that today. Such protection is provided for under existing equality laws.

"However, our view is that to give certainty on protection for individual celebrants taking a different view from a religious body that does agree to conduct same-sex marriages, an amendment will be required to the UK Equality Act."

The Scottish government said it was now going ahead with another consultation to consider what extra measures are needed to guarantee freedom of speech, including the protection of religious beliefs of teachers and parents in schools.

Ministers said the Scottish Catholic Education Service would continue to decide on the faith content of the curriculum in Catholic denominational schools.

Welcoming the government's approach, Tom French, policy co-ordinator for the Equality Network, said: "Same-sex marriage is about equality and freedom - the freedom for couples, and religious and humanist groups that want to, to celebrate same-sex marriages, but equally, upholding the freedom of other religious groups to say no to same-sex marriages.

"That's the right way for Scotland to deal with the different opinions on this."

The Church of Scotland, which will report on its own investigation of the issue in May 2013, expressed concern the government was rushing ahead with its plans.

The Rev Alan Hamilton, convener of the Church of Scotland legal questions committee, said: "We are acutely aware that opinions differ among our own members and that many people are anxious and hurt in the current situation.

"We believe homophobia to be sinful and we reaffirm our strong pastoral commitment to all people in Scotland, regardless of sexual orientation or beliefs."

He added: "We are concerned the government will legislate without being able to effectively protect religious bodies or their ministers whose beliefs prevent them from celebrating civil-partnerships or same-sex marriages."

Gay marriage consultation The Scottish government held a public consultation into the issue of same-sex marriage.

It had the biggest response of any Scottish government consultation.

There were 77,508 responses in total, with 14,779 from outside Scotland.

Some 64% of those who responded [including postcard and petition responses] said they were against same-sex marriage.

Excluding postcard and petition responses to the consultation from within Scotland the outcome shows 65% were in favour and 35% against.

A spokesman for the Catholic Church in Scotland said: "The Scottish government is embarking on a dangerous social experiment on a massive scale.

"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."

Civil partnerships in Scotland offer the same legal treatment as marriage, but are still seen as distinct from marriage.

The UK government, which is consulting on changing the status of civil ceremonies to allow gay and lesbian couples in England and Wales to get married, wants to make the change by 2015.