The US Senate passed the Respect for Marriage Act on November 29 by a vote of 61-36, with 12 Republicans joining 49 Democrats and Independents in voting for the measure.
The bill now goes to the US House, where it's expected to pass with a comfortable majority.
The bipartisan yes vote didn't happen on its own, however. It was the result of hours of behind-the-scenes work and some skillful horse-trading by the measure's managers.
According to Politico, Republican Sens. Rob Portman (R-OH), Susan Collins (R-ME), and Lisa Murkowski (R-AK) have long favored legalization of same-sex marriage and have quietly lobbied their GOP colleagues to get on board.
They alone would give Democrats more than enough votes to pass the bill, but more votes were needed to overcome the 60-vote threshold for bringing legislation to the floor for a vote.
The first key to getting those votes was to limit the bill's scope.
The bill repeals the infamous Defense of Marriage Act and stipulates that the federal government recognizes all lawful same-sex — and interracial — marriages. It also requires states to recognize all lawful marriages performed in other states, regardless of their own marriage laws.
Stopping short of legalizing same-sex marriage nationwide was reportedly the "out" some Republican senators needed to be able to support the measure without fearing backlash from their voters at home.
For example, Sen. Cynthis Lummis (R-WY) said that she accepts her church's beliefs that a marriage is between a man and a woman, but noted that the country was founded on the separation of church and state.
"We do well by taking this step, not embracing or validating each other's devoutly held views, but by the simple act of tolerating them," Lummis said.
In another concession to Republicans, the bill contains language that protects church's tax-exempt status in case they refuse to perform same-sex or mixed-race marriage ceremonies. This allowed GOP senators to continue to present themselves as champions of First Amendment religious rights.
In a floor speech, Sen. Thom Tillis (R-NC) pointed to the number of religious groups supporting the bill, including the Mormon Church. Some of those groups were invited to be part of negotiations on the bipartisan amendment, Politico noted.
"They see this as a step forward for religious freedom," Tillis said.
Another tactical compromise was to delay the vote on the measure until after the November election. This allowed Republican senators to commit privately to vote for the bill when it came to the floor, but to avoid having to make a campaign issue.
Senate Majority Leader Chuck Schumer (D-NY) reportedly decided in September to delay a floor vote until after the election. Bill managers Tammy Baldwin (D-WI) and Kyrsten Sinema (D-AZ) agreed because they did not want to risk failure when they knew they could win after the midterms.
This concession also seemed to pay off. Sen. Todd Young (R-IN), for example, voted in favor of the measure after being reelected in the November election, in a campaign in which marriage equality was a non-issue.
The concessions were substantial, and they will not protect all the rights now enjoyed by same-sex couples under the Obergefell decision, but the passage of the bill is still a welcome victory.
"Our community really needs a win, we have been through a lot," said Kelley Robinson, the incoming president of HRC. "As a Queer person who is married, I feel a sense of relief right now. I know my family is safe."