The U.S. House on Tuesday approved a bill that protects same-sex marriage.

The measure, titled the Respect for Marriage Act, cleared the chamber with a 267-157 vote. Forty-seven Republicans joined all Democrats in supporting the legislation.

New York Representative Jerrold Nadler, a Democrat, first introduced the bill in 2009, roughly six years before the Supreme Court in Obergefell found that gay and lesbian couples have a constitutional right to marry.

Nadler said that it was important to codify the high court's opinion after it struck down Roe v. Wade, which like Obergefell was based on the right to privacy.

“The Supreme Court’s recent decision in Dobbs v. Jackson Women’s Health – which extinguished the constitutional right to abortion – has raised concerns among some people that other rights rooted in the constitutional right to privacy may be at risk, notwithstanding the Court’s assurance that Dobbs was limited to abortion. This includes the right to marriage equality,” Nadler said on the House floor.

“This legislation would provide additional stability for the lives that families have built upon the foundation of our fundamental rights. Congress must pass the Respect for Marriage Act to dispel any concern or uncertainty for families worried by the implications of the Dobbs decision. And it must pass the Respect for Marriage Act to enshrine in law the equality and liberty that our Constitution guarantees,” he said.

The Respect for Marriage Act repeals the Defense of Marriage Act (DOMA), a law that prohibited the federal government from recognizing the legal marriages of gay couples. The Supreme Court struck down DOMA in 2013. The Respect for Marriage Act also requires states to recognize the marriages of gay couples performed in different states.

The Human Rights Campaign (HRC), the nation's largest LGBTQ rights advocate, cheered passage of the bill with strong bipartisan support.

“The fact that this bill passed with strong bipartisan support – earning the votes of 47 Republicans, proves that marriage equality is supported by a wide swath of the American people, and is not going anywhere,” HRC Interim President Joni Madison said in a statement. “We strongly urge the Senate to follow the example set by their colleagues in the House and vote to pass this bill.”

The legislation now heads to the Senate where it faces an uncertain future.