In its first move, the court ruled that a significant portion of the Defense of Marriage Act (DOMA) is unconstitutional, saying it "violates basic due process and equal protection principles applicable to the federal government."

"DOMA instructs all federal officials, and indeed all persons with whom same-sex couples interact, including their own children, that their marriage is less worthy than the marriages of others," Justice Anthony Kennedy wrote for the court.

In the second case, Hollingsworth v. Perry, the court essentially allowed same-sex marriages to resume in California. The court said that supporters of the state ban on same-sex marriages, 2008's Proposition 8, couldn't challenge a lower court's decision striking it down.

The first case, United States v. Windsor, challenged the federal Defense of Marriage Act (DOMA) of 1996, which defines marriage as " only a legal union between one man and one woman as husband and wife." (It also says states don't have to recognize other states' same-sex marriages; there is debate over how today's ruling will affect that part of the law.) In the case, the widow of a same-sex union recognized by New York sued to receive a federal tax refund on estate taxes she paid—something she would have received had she married a man.

The court's ruling will take effect immediately. It does not automatically establish a constitutional right to same-sex marriage, but rather said the federal government must recognize same-sex marriages if they are allowed by states.

President Barack Obama already rescinded his support for DOMA in 2011, when he officially declared his support for same-sex marriage. Since then, however, Republicans in the House of Representatives have defended the law.

Hollingsworth v. Perry took on California's Proposition 8, the state's ban on same-sex marriage. Voters approved the measure in 2008, after the California Supreme Court ordered that the state begin issuing same-sex marriage licenses. Gay rights advocates challenged the ban soon after it passed, and the state of California declined to defend the measure after a district court ruled it unconstitutional. That left the proposition's sponsors to appeal the decision, something the Supreme Court today said they couldn't do.

In 2010, an appeals court deemed Proposition 8 unconstitutional not only because it burdens gay and lesbian couples right to marry, but also because it "creates an irrational classification on the basis of sexual orientation."

But the Supreme Court's ruling today didn't address such questions, and focused on the ability of Prop. 8's sponsors, ProtectMarriage, to defend the law in court.

"We have never before upheld the standing of a private party to defend the constitutionality of a state statute when state officials have chosen not to. We decline to do so for the first time here," Chief Justice John Roberts wrote.

The votes in both cases were 5-4, though the makeup of the majority decisions differed.

Justice Antonin Scalia, who sided with the majority on the Proposition 8 case, wrote a strongly worded dissent on the DOMA case, which he read aloud from from the bench:

The majority says that the supporters of this Act acted with malice—with the "purpose" "to disparage and to injure" same-sex couples. It says that the motivation for DOMA was to "demean," to "impose inequality," to "impose … a stigma," to deny people "equal dignity," to brand gay people as "unworthy," and to "humiliate" their children. I am sure these accusations are quite untrue. … It is one thing for a society to elect change; it is another for a court of law to impose change by adjudging those who oppose it hostes humani generis, enemies of the human race. … It is hard to admit that one's political opponents are not monsters, especially in a struggle like this one, and the challenge in the end proves more than today's Court can handle. Too bad.