This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

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

President Joe Biden is expected to promptly sign the measure, which requires all states to recognize same-sex marriages, 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, which passed 258-169 with almost 40 Republican votes, would also protect interracial unions by requiring states to recognize legal marriages regardless of “sex, race, ethnicity, or national origin.” After months of talks, the Senate passed the bill last week with 12 Republican votes.

In debate ahead of the vote, several gay members of Congress talked about what it would mean for them and their families. Rep. Chris Pappas, D-N.H., said he was set to marry “the love of my life” next year and that it is “unthinkable” that his marriage might not be recognized in some states.

Rep. Mark Pocan, D-Wis., said he and his husband should be able to visit each other in the hospital just like any other married couple and receive spousal benefits “regardless of if your spouse’s name Samuel or Samantha.”

Rep. David Cicilline, D-R.I., said that the idea of marriage equality used to be a “far fetched idea, Now it’s the law of the land and supported by the vast majority of Americans.”

Democrats moved the bill quickly through the House and Senate after 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.

Latest Top Stories

The legislation lost some Republican support since July, when 47 Republicans voted for it — a robust and unexpected show of support that kick-started serious negotiations in the Senate. But most of those lawmakers held firm.

“To me this is really just standing with the Constitution,” said Republican Rep. Ann Wagner of Missouri, who voted for it both times. She pushed back on GOP arguments that it would affect religious rights of those who don’t believe in same sex marriage.

“No one’s religious. liberties are affected in any way, shape or form,” Wagner said.

House Speaker Nancy Pelosi, D-Calif., presided over the vote as one of her last acts in leadership before stepping aside in January. She said the legislation “will ensure that “the federal government will never again stand in the way of marrying the person you love.”

The legislation would not require states to allow same-sex couples to marry, as the Supreme Court’s 2015 Obergefell v. Hodges decision now does. But it would require states to recognize all marriages that were legal where they were performed and it would protect current same-sex unions if the Obergefell decision were overturned.

While it’s not everything advocates may have wanted, passage of the legislation represents a watershed moment. Just a decade ago, many Republicans openly campaigned on blocking same-sex marriages; today more than two-thirds of the public support them.

Still, most Republicans opposed the legislation and some conservative advocacy groups lobbied aggressively against it in recent weeks, arguing that it doesn’t do enough to protect those who want to refuse services for same-sex couples.

“God’s perfect design is indeed marriage between one man and one woman for life,” said Rep. Bob Good, R-Va, ahead of the vote. “And it doesn’t matter what you think or what I think, that’s what the Bible says.”

Rep. Vicky Hartzler, R-Mo., choked up as she begged colleagues to vote against the bill, which she said undermines “natural marriage” between a man and a woman.

“I’ll tell you my priorities,” Hartzler said. “Protect religious liberty, protect people of faith and protect Americans who believe in the true meaning of marriage.”

Democrats in the Senate, led by Wisconsin’s Tammy Baldwin and Arizona’s Kyrsten Sinema, tried to address those GOP concerns by negotiating an amendment that would clarify that the legislation does not affect the rights of private individuals or businesses that are already enshrined in current law. The amended bill would also make clear that a marriage is between two people, an effort to ward off some far-right criticism that the legislation could endorse polygamy.

In the end, several religious groups, including The Church of Jesus Christ of Latter-day Saints, came out in support of the bill. The Mormon church said it would support rights for same-sex couples as long as they didn’t infringe upon religious groups’ right to believe as they choose.

Thursday’s vote came as the LGBTQ community has faced violent attacks, such as the shooting earlier this month at a gay nightclub in Colorado that killed five people and injured at least 17.

“We have been through a lot,” said Kelley Robinson, the incoming president of the advocacy group Human Rights Campaign. But Robinson says the votes show “in such an important way” that the country values LBGTQ people.

“We are part of the full story of what it means to be an American,” said Robinson, who was inside the Senate chamber for last week’s vote with her wife and young son. “It really speaks to them validating our love.”

The vote was personal for many senators, too. The day the bill passed their chamber, Senate Majority Leader Chuck Schumer was wearing the tie he wore at his daughter’s wedding to another woman. He recalled that day as “one of the happiest moments of my life.”

Baldwin, the first openly gay senator who has been working on gay rights issues for almost four decades, tearfully hugged Schumer as the final vote was underway. She tweeted thanks to the same-sex and interracial couples who she said made the moment possible.

“By living as your true selves, you changed the hearts and minds of people around you,” she wrote.