In response to court action in a number of states, the United States federal government and a number of state legislatures passed or attempted to pass legislation either prohibiting or allowing same-sex marriage or other types of same-sex unions.

On June 26, 2015, the Supreme Court of the United States ruled in the case of Obergefell v. Hodges that a fundamental right to marry is guaranteed to same-sex couples by the Fourteenth Amendment, and that states must allow same-sex marriage.

Federal level In 1996, the United States Congress passed and President Bill Clinton signed Public Law 104–199, the Defense of Marriage Act (DOMA). Section 3 of DOMA defines "marriage" and "spouse" for purposes of both federal law and any ruling, regulation, or interpretation by an administrative bureau or agency of the United States government. The impact of Section 2 of DOMA, which relieves jurisdictions within the United States of any obligation to recognize same-sex relationships legally established in any other jurisdiction, is less clear.

In United States v. Windsor, the Supreme Court was asked to determine the constitutionality of Section 3 of DOMA, which defines marriage for federal purposes as the union of a man and a woman.Petition for Certiorari (No 12-307). Retrieved December 8, 2012 On June 26, 2013, the Supreme Court ruled by a 5–4 vote that the Section 3 of DOMA is unconstitutional.

The State Marriage Defense Act, introduced in the House of Representatives on January 9, 2014, would require the federal government to recognize the validity of a marriage based on a person's legal residence (place of domicile), rather than on the validity of the marriage when and where it was solemnized (place of celebration). The Obama administration has generally used the latter standard. Its sponsors described it as a way to clarify the federal government's response to Windsor and restore the ability of the a state to control the definition of marriage within its borders.

In Obergefell v. Hodges, the Supreme Court was asked to determine the constitutionality of state bans on same-sex marriage licenses as well as state bans on recognition of same-sex marriages from other states. On June 26, 2015, the court ruled by a 5–4 vote that the Fourteenth Amendment obliges states to license same-sex marriages and to recognize same-sex marriages from other states.

In the , and Congresses, the Respect for Marriage Act (RFMA) was introduced by House and Senate Democrats to repeal DOMA. These efforts eventually prevailed in 2022, with the bill passing the House 267–157 and the Senate 61–36. President Joe Biden signed the bill into law on December 13, 2022.

State level

Efforts to enable same-sex unions Votes by state legislatures to recognize various types of same-sex unions, sorted by date: