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, would also protect interracial unions by requiring states to recognize legal marriages regardless of “sex, race, ethnicity, or national origin.”