US President Joe Biden signed a law recognizing same-sex marriages at the federal level, world agencies reported. 

"The law and the love it protects strike a blow against hate in all its forms. That's why this law matters to every single American," said the head of state. 

Senate defends gay marriage in US from Supreme Court rulings

Lawmakers from both parties, First Lady Jill Biden, Vice President Kamala Harris and her husband Doug Emhoff were in attendance, and singers Sam Smith and Cyndi Lauper sang to the crowd. 

Senate Majority Leader Chuck Schumer wore the same purple tie he wore to the wedding of his daughter, who is expecting his first child with his wife in the spring. 

"Thanks to the hard work of many of my colleagues, my grandson will live in a world that respects and honors his mothers' marriage," Schumer said on the Senate floor this morning. 

The new law is intended to protect same-sex marriage if the Supreme Court ever overturns its 2015 decision legalizing same-sex marriage nationwide.

The new legislation also protects interracial marriages.

In 1967, the Supreme Court struck down the laws of 16 US states prohibiting interracial marriage.

The law's signing is the culmination of months of bipartisan efforts spurred by the Supreme Court's decision in June to overturn its 1973 ruling guaranteeing abortion rights nationwide.

Lawmakers reached a compromise that should assuage conservative concerns about religious freedom, such as allowing churches to refuse to perform same-sex marriages. 

Individual states would not be required to issue marriage licenses to same-sex couples, but they would be required to recognize marriages performed in other parts of the country. 

However, the majority of Republicans in Congress voted against the law, which nevertheless received enough support to pass.