|Democratic Governor Andrew Cuomo proposed the measure to legalise gay marriage [GALLO/GETTY]
The New York State Senate has voted to allow gay marriage, leaving only what is expected to be a swift approval from the governor as the last step before the state becomes the sixth and largest in America to allow men and women to marry people of the same sex.
The senate chamber erupted in applause from a packed gallery during an initial 36-26 vote that approved an amendment to the bill that would protect religious institutions that do not want to grant gay marriages, and more cheers could be heard echoing outside for minutes afterward.
The amendment vote paved the way for approval of the bill, which followed after nearly an hour of at-times emotional speeches.
The 33-29 vote split almost entirely along party lines, reversing a 2009 vote that defeated a similar same-sex marriage measure.
Four Republicans joined 29 Democrats in approving the measure on Friday, while one Democrat voted against the bill.
First for Republicans
In approving the bill, which was passed to the senate after moving through the assembly, New York's legislature became the first controlled by Republicans to pass a bill allowing gay marriage.
Shortly before the vote, longtime Republican Senator Stephen Saland described the debate behind it and revealed that he would be voting in favour, though he had voted against the 2009 measure.
He said he had been raised to be tolerant of all people and that the only way to avoid "flying in the face" of his upbringing was to vote for marriage equality.
In 2009, the senate was controlled by Democrats, who in other states have usually viewed gay marriage more favourably than Republicans.
The current New York senate is controlled by Republicans, but Democratic Governor Andrew Cuomo has pushed hard to persuade senators to vote in favour of what he has said is a priority of his administration.
Senate Republicans allowed the measure to come to a vote only after behind-the-scenes talks between them and Cuomo, the New York Times reported.
Republicans were concerned that the measure protect religious institutions that do not want to marry people of the same sex.
Some remained opposed. Senator Ruben Diaz said he was the only Democrat voting against the bill and wore the fact as a "badge of honour".
Referring to the capital of the state, Diaz said that "God, not Albany, has settled the definition of marriage a long time ago."
New York support
Five states in America currently allow gay marriages: Connecticut, Iowa, Massachusetts, New Hampshire, and Vermont.
No states in the traditionally conservative south allow it. Washington DC, the federal district, also allows gay marriage.
Legal and political battles over gay marriage have raged throughout the US for more than a decade, and the issue has often gone to court.
New York residents have supported gay marriage since 2009, according to polls conducted by Quinnipiac University.
That year, 51 per cent responded that they favoured it; in June, another poll found that group had grown to 58 per cent.
Support predictably split along party lines: 72 per cent of Democrats in the survey approved of gay marriage, while only 34 per cent of Republicans did.
Internationally, same-sex marriage is allowed in 10 countries, including Canada, Argentina, Sweden and South Africa. The Netherlands became the first country to allow it in 2001.
Many other countries provide for unions that grant same-sex couples all the legal rights of marriage without allowing the use of the name.