IT was a historic day marked by an impassioned debate which ended with applause from supporters in the public gallery.

As MSPs met to vote on same-sex marriage, the two lobbies camped outside parliament to make their final protests. In truth, both gatherings were fairly subdued, not least because of the inevitability of the outcome.

Steven Camley's cartoon

There were impressive contributions from both sides, but the recurring theme was of the dramatic change of social attitudes and legal status in the 34 years since Scotland decriminalised homosexuality.

In the end, the vote was overwhelmingly in favour of making Scotland the 17th country in the world to legalise same-sex marriage as MSPs backed the Marriage and Civil Partnership ­(Scotland) Bill by 105 votes to just 18.

It fell as an equality issue to Alex Neil, Secretary for Health and Well­being, to push the bill through its final stage and he relished the task, pledging that with agreement from Westminster, same-sex marriages could be carried out in Scotland later this year.

He said: "Our society has changed, and changed for the better. Within my own adult life we've seen the criminalisation of homosexual acts ended, and the introduction of civil partnerships.

"Today is a momentous day for ­equality in our nation. No longer will persons of the same sex be barred from showing their commitment to each other through getting married.

"This legislation sends a powerful message to the world about the kind of Scotland we seek to create - a nation where the principles of fairness and equality are weaved into the very fabric of our society, a nation that protects and promotes freedom of expression, a nation that cherishes love."

Green MSP Patrick Harvie spoke eloquently of the difference this decision would have made to him as a young man struggling over the decision to come out as gay, and he said the bill should be used to promote gay rights to countries with a bad record on equality and whose representatives will be visiting Glasgow for the Commonwealth Games.

The lengthy debate featured "chicken farms, Tannadice and South Pacific" - a quote from Mr Harvie as he summarised the unusual contributions from others backing the legislation. The chicken farms reference came from French-born SNP MSP Christian Allard as he recalled his own youthful prejudice against rural neighbours.

Tannadice was mentioned by Conservative Mary Scanlon in relation to the use of "gay" as an insult in the abuse of referees. She spoke of the way her own journey on attitudes to gay people matched the shift in opinion mapped by the Scottish Social Attitudes study.

Deputy Conservative leader Jackson Carlaw cited a song from South Pacific, which contains the line "you've got to be taught to hate and fear".

In the debate, particularly the early section where amendments were considered, the SNP's John Mason did sterling service for the opposing side, pitching a series of changes he felt would protect religious freedom, backed by colleague Richard Lyle and Tories Margaret Mitchell and Alex Johnstone.

SNP MSPs Jim Eadie and Marco Biagi defended the bill as containing sufficient safeguards, with the latter's main speech comprising almost entirely the words of Edinburgh Central constituents who had written to him pleading for the need for this change in the law. His contribution was among the most moving of the day.

The outcome sparked a burst of applause. But despite the vote, the bill continues to polarise opinion, with some church leaders viewing it as an assault on tradition. Alex Hamilton, convener of the Church of Scotland's legal questions committee, said: "We do not expect that our ministers would ever be forced to carry out same-sex marriages.

"We are also concerned that public servants, particularly registrars and teachers, who do not support same-sex marriage, may find themselves disadvantaged in the workplace. We continue to call upon the Scottish Government and Parliament to provide meaningful assurances that their freedom of conscience will be respected."

Fred Drummond, director of the Evangelical Alliance Scotland, said: "This legislation sends all the wrong signals about the place of marriage and family, which are the bedrock of society and we should be celebrating and encouraging them, but this legislation does neither."

However, Tom French, of the Equality Network, said: "Today will be remembered as the day lesbian, gay and bisexual people were finally granted full legal equality in Scotland, and given an equal right to marry the person they love. Scotland can be proud that we now have one of the most progressive equal marriage bills in the world."

Nathan and Robert Gale, who had a civil partnership ceremony over four years ago, hope to be the first in Scotland to have a same-sex marriage, in a ceremony performed by one of their mothers. Nathan's mother, Shirley Young, is a part-time registrar and said she would be delighted to conduct the ceremony.