The US Senate has passed a landmark bill protecting same-sex marriage, as lawmakers from both parties moved to forestall the possibility of the conservative-led Supreme Court taking away this right as it did with abortion.
"With today's bipartisan Senate passage of the Respect for Marriage Act, the United States is on the brink of reaffirming a fundamental truth: love is love, and Americans should have the right to marry the person they love," President Joe Biden said in a statement released after the 61-36 vote.
The Senate vote sends the bill back to the House of Representatives, which Speaker Nancy Pelosi said would approve it next week before sending it to President Biden to sign.
Senate majority leader Chuck Schumer hailed a "momentous step forward for greater justice for LGBTQ Americans."
Twelve Republicans joined Democrats to pass the legislation on what had for decades been a deeply divisive issue in America.
In the United States, same-sex unions have been guaranteed by the Supreme Court since 2015.
But after the court's historic overturning of a longstanding ruling protecting the right to abortion in June, many progressives feared that same-sex marriage may also be under threat.
Democrats have worked with urgency to get the bill passed while they still control Congress.
They held on to the Senate in this month's mid-term elections but lost the House to the Republicans, although the latter eked out a much thinner majority than they had expected.
So when the new Congress takes power in January, gridlock is expected.
The bill passed yesterday does not require states to legalise same-sex marriage.
But it repeals previous legislation defining marriage as a union between a man and a woman and does require states to recognise same-sex marriages from other states.
So if the Supreme Court were to overturn the 2015 ruling that legalised same-sex marriages, a state that bans them will still have to recognise such unions carried out in other states. The bill also applies to inter-racial marriages.
"Today's vote is deeply personal for many of us in this chamber," said Schumer, who wore the same tie he had on at his lesbian daughter's wedding.
A similar bill was already passed in June by the House of Representatives. All the chamber's Democrats voted in favour, along with 47 Republicans.
A new vote in the House is needed to reconcile the two bills but this is seen as a formality.
The powerful American Civil Liberties Union hailed the "historic step forward" but denounced the rise of laws attacking the right of transgender people in several states.
"While we welcome the historic vote on this measure, members of Congress must also fight like trans lives depend on their efforts because trans lives do," James Esseks, director of the ACLU's LGBTQ & HIV Rights Project, said in a statement.
Polls show a strong majority of Americans back same-sex marriage but it is still contentious.
Thirty-six Republicans voted 'no' on and the religious right remains mostly opposed to such unions.