WASHINGTON (AP) — Legislation to protect same-sex and interracial marriages crossed a major Senate hurdle Wednesday, putting Congress on track to take the historic step of ensuring that such unions are enshrined in federal law.

Twelve Republicans voted with all Democrats to move forward on the legislation, meaning a final vote could come as soon as this week, or later this month. Senate Majority Leader Chuck Schumer said the bill ensuring the unions are legally recognized under the law is chance for the Senate to “live up to its highest ideals” and protect marriage equality for all people.

“It will make our country a better, fairer place to live,” Schumer said, noting that his own daughter and her wife are expecting a baby next year.

Senate Democrats are quickly moving to pass the bill while the party still controls the House. Republicans won the House majority Wednesday and are unlikely to take up the issue next year.

In a statement after the vote, President Joe Biden said that he will sign the bill once it is passed.

“Love is love, and Americans should have the right to marry the person they love,” Biden said.

The bill has gained steady momentum since the Supreme Court’s June decision that overturned Roe v. Wade and the federal right to an abortion. An opinion at that time from Justice Clarence Thomas suggested that an earlier high court decision protecting same-sex marriage could also come under threat.

The legislation would repeal the Clinton-era Defense of Marriage Act and require states to recognize all marriages that were legal where they were performed. The new Respect for Marriage Act would also protect interracial marriages by requiring states to recognize legal marriages regardless of “sex, race, ethnicity, or national origin.”

Congress has been moving to protect same-sex marriage as support from the general public — and from Republicans in particular — has sharply grown in recent years, as the Supreme Court’s 2015 Obergefell v. Hodges decision legalized gay marriage nationwide. Recent polling has found more than two-thirds of the public supports same-sex unions.

Still, many Republicans in Congress have been reluctant to support the legislation, with many saying it was unnecessary while the marriages are still protected by the courts. Democrats delayed consideration until after the midterm elections, hoping that would relieve political pressure on some GOP senators who might be wavering.

A proposed amendment to the bill, negotiated by supporters to bring more Republicans on board, would clarify that it does not affect rights of private individuals or businesses that are already enshrined in law. Another tweak would make clear that a marriage is between two people, an effort to ward off some far-right criticism that the legislation could endorse polygamy.

Three Republicans said early on that they would support the legislation and have lobbied their GOP colleagues to support it: Maine Sen. Susan Collins, North Carolina Sen. Thom Tillis and Ohio Sen. Rob Portman. They argued that there was still value in enshrining the rights for such marriages even if the courts don’t invalidate them.

“Current federal law doesn’t reflect the will or beliefs of the American people,” Portman said ahead of the vote. “It’s time for the Senate to settle the issue.”

In the end, nine of their GOP colleagues joined them in voting for it, bringing the total to twelve and providing enough votes needed to overcome a filibuster in the 50-50 Senate. The other Republicans who voted for the legislation were Sens. Richard Burr of North Carolina, Todd Young of Indiana, Shelley Moore Capito of West Virginia, Mitt Romney of Utah, Joni Ernst of Iowa, Roy Blunt of Missouri, Cynthia Lummis of Wyoming and Lisa Murkowski and Dan Sullivan of Alaska.

The growing GOP support for the issue is a sharp contrast from even a decade ago, when many Republicans vocally opposed same-sex marriages. The legislation passed the House in a July vote with the support of 47 Republicans — a larger-than-expected number that gave the measure a boost in the Senate.

On Tuesday, The Church of Jesus Christ of Latter-day Saints became the most recent conservative-leaning group to back the legislation. In a statement, the Utah-based faith said church doctrine would continue to consider same-sex relationships to be against God’s commandments, but it would support rights for same-sex couples as long as they didn’t infringe upon religious groups’ right to believe as they choose.

Wisconsin Sen. Tammy Baldwin, a Democrat who is the first openly gay senator and has been working on gay rights issues for almost four decades, said the newfound openness from many Republicans on the subject reminds her “of the arc of the LBGTQ movement to begin with, in the early days when people weren’t out and people knew gay people by myths and stereotypes.”

Baldwin said that as more individuals and families have become visible, hearts and minds have changed.

“And slowly laws have followed,” she said. “It is history.”

Schumer said the issue is personal to him, as well.

“Passing the Respect for Marriage Act is as personal as it gets for many senators and their staffs, myself included,” Schumer said. “My daughter and her wife are actually expecting a little baby in February. So it matters a lot to so many of us to get this done.”

___

Associated Press writer Sam Metz in Salt Lake City contributed to this report.