Bill protecting gay and interracial marriages to be signed into law Tuesday

President Joe Biden is inviting thousands to celebrate at the White House on Tuesday as he signs into law gay marriage legislation before a bipartisan crowd that reflects growing acceptance of same-sex unions.

Lawmakers from both parties will be there, as will first lady Jill Biden and Vice President Kamala Harris and her husband, Doug Emhoff. The White House promised musical performances but was trying to maintain suspense about the headliners.

The triumphant mood will play out against the backdrop of a right-wing backlash over gender issues, which has alarmed gay and transgender people and their advocates.

Among the attendees will be the owner of Club Q, a gay nightclub in Colorado where five people were killed in a shooting last month, and two survivors of the attack. The suspect has been charged with hate crimes.

Plaintiffs from lawsuits that originally helped secure the nationwide right to gay marriage are also expected to be there, according to the White House.

RELATED: Senate passes landmark same-sex marriage bill

The new law is intended to safeguard gay marriages if the U.S. Supreme Court ever reverses Obergefell v. Hodges, its 2015 decision legalizing same-sex unions nationwide. The new law also protects interracial marriages. In 1967, the Supreme Court in Loving v. Virginia struck down laws in 16 states barring interracial marriage.

"Congress has restored a measure of security to millions of marriages and families," Biden said in a statement when the legislation passed last week. "They have also provided hope and dignity to millions of young people across this country who can grow up knowing that their government will recognize and respect the families they build."

The signing will mark the culmination of a monthslong bipartisan effort sparked by the Supreme Court’s decision in June to overturn Roe v. Wade, the 1973 ruling that made abortion available across the country.

In a concurring opinion in the case that overturned Roe, Justice Clarence Thomas suggested revisiting other decisions, including the legalization of gay marriage, generating fear that more civil rights could be imperiled by the court’s conservative majority.

Lawmakers crafted a compromise that was intended to assuage conservative concerns about religious liberty, such as ensuring churches could still refuse to perform gay marriages.

In addition, states will not be required to issue marriage licenses to same-sex couples. But they will be required to recognize marriages conducted elsewhere in the country.

A majority of Republicans in Congress still voted against the legislation. However, enough supported it to sidestep a filibuster in the Senate and ensure its passage.

"Together, we showed that it’s possible for Democrats and Republicans to come together to safeguard our most fundamental rights," Biden said.

Tuesday’s ceremony will mark another chapter in Biden’s legacy on gay rights.

He memorably — and unexpectedly — endorsed same-sex unions in a television interview in 2012, when he was vice president. Days later, President Barack Obama announced that he also supported gay marriage.

Attendees will be given a card commemorating Biden’s comments from his 2012 interview.

"What this is all about is a simple proposition: Who do you love?" Biden said on NBC’s "Meet the Press" a decade ago. "Who do you love and will you be loyal to the person you love? And that is what people are finding out is what all marriages at their root are about."

Since becoming president, Biden has reversed President Donald Trump’s efforts to strip transgender people of anti-discrimination protections. His administration includes the first openly gay Cabinet member, Transportation Secretary Pete Buttigieg, and the first transgender person to receive Senate confirmation, Assistant Secretary for Health Rachel Levine.