WASHINGTON, Dec. 8 (AP) — The House is set to give final approval Thursday to legislation protecting same-sex marriages in federal law, a monumental step in a decadeslong battle for nationwide recognition of such unions that reflects a stunning turnaround in societal attitudes.

A law requiring all states to recognize same-sex marriages would come as a a relief for hundreds of thousands of couples who have married since the Supreme Court’s 2015 decision that legalized those marriages nationwide. The bipartisan legislation would also protect interracial unions by requiring states to recognize legal marriages regardless of “sex, race, ethnicity, or national origin.”

President Joe Biden backs the bill and said he will “promptly and proudly” sign it into law.

Democrats have moved the bill quickly through the House and Senate since the Supreme Court’s June decision that overturned the federal right to an abortion. That ruling included a concurring opinion from Justice Clarence Thomas that suggested same-sex marriage should also be reconsidered.

Roused to action by the court, the House passed a bill to protect the same-sex unions in July with the support of 47 Republicans, a robust and unexpected show of support that kick-started serious negotiations in the Senate. After months of talks, the Senate passed the legislation last week with 12 Republican votes.