The US Senate passed a bill on Tuesday that would protect federal recognition of same-sex marriage, a measure taken up in response to worries the Supreme Court could overturn a 2015 decision that legalised it nationwide.
The narrowly tailored bill, which would require the federal government to recognise a marriage if it was legal in the state in which it was performed, is meant to be a backstop if the Supreme Court acted against same-sex marriage.
It would not bar states from blocking same-sex or interracial marriages if the Supreme Court allowed them to do so.
"Today the long but inexorable march towards greater equality advances forward," senate majority leader Chuck Schumer said in a statement.
"By passing this bill, the Senate is sending a message that every American needs to hear: no matter who you are or who you love, you too deserve dignity and equal treatment under the law."
The bill was passed 61 to 36, with 60 votes needed for passage. Twelve Republicans joined 49 Democrats in supporting the bill. One Democrat, Georgia's Raphael Warnock, was absent, as were two Republican senators.
A similar, but not identical, bill passed the House of Representatives earlier this year with support from 47 Republicans and all Democrats. The House would need to approve the Senate version before it is sent to President Joe Biden to sign into law.
No. 2 House Democrat Steny Hoyer told reporters on Tuesday the House would likely take up the Senate's version of the bill next week.
In June, the Supreme Court overturned the nationwide right to an abortion, undoing 50 years of precedent.
In a concurring opinion, Supreme Court justice Clarence Thomas wrote the court should consider reversing other decisions protecting individual freedoms, including the 2015 ruling on gay marriage.
About 568,000 married same-sex couples live in the US, according to the US Census Bureau.