Seventeen years after a Democratic President signed a federal law defining marriage as between a man and a woman, the U.S. Supreme Court struck it down on Wednesday, capping one of the fastest civil rights shifts in the nation’s history.

In a landmark 5-4 decision, the Justices ruled that the Defense of Marriage Act (DOMA), passed by bipartisan majorities and signed by President Bill Clinton, is an unconstitutional violation of the Fifth Amendment.

The court broke along familiar ideological lines, with Justice Anthony Kennedy, who authored the majority opinion, joining his four more liberal counterparts. “DOMA is unconstitutional as a deprivation of the equal liberty of persons that is protected by the Fifth Amendment,” Kennedy wrote. Chief Justice John Roberts, Justice Antonin Scalia and Justice Samuel Alito filed separate dissents to the court’s decision. Scalia delivered a lengthy and scathing oral dissent in court after the decision was announced.

The offending section of the law, which sailed through Congress in 1996, restricted gay couples from receiving more than 1,000 benefits accorded to married couples, even if they were legally married in the states where they reside. In a forceful indictment of the law, Kennedy cited the contradictions between state and federal statutes as among the reasons for striking down the measure.

“By creating two contradictory marriage regimes within the same state, DOMA forces same-sex couples to live as married for the purpose of state law but unmarried for the purpose of federal law,” he wrote. “DOMA undermines both the public and private significance of state-sanctioned same-sex marriages; for it tells those couples, and all the world, that their otherwise valid marriages are unworthy of federal recognition. This places same-sex couples in an unstable position of being in a second-tier marriage. The differentiation demeans the couple, whose moral and sexual choices the Constitution protects … and whose relationship the state has sought to dignify. And it humiliates tens of thousands of children now being raised by same-sex couples.”

The case, Windsor v. United States, was filed by New York resident Edith Windsor, who was legally married in Canada to Thea Spyer. Upon Spyer’s death in 2009, Windsor was required to pay estate taxes on her inheritance — which she would not have been asked to do had she been married to a man.

“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,” Kennedy wrote. “The federal statute is invalid, for no legitimate purpose overcomes the purpose and effect to disparage and to injure those whom the state, by its marriage laws, sought to protect in personhood and dignity.”

In February 2011, the Obama Administration announced it would no longer defend the law in court. The decision spurred Speaker of the House John Boehner to appropriate funds from the House of Representatives budget to defend it before the Supreme Court.

In a separate 5-4 decision, the Supreme Court cleared the way for same-sex marriages to resume in California, ruling that those appealing to uphold the ban known as Proposition 8 did not have legal standing. The court’s technical ruling — that outside appellants don’t have standing to defend a law if the state declines to defend it — is narrowly tailored and avoids a ruling on the constitutionality of all same-sex-marriage bans.

Bedlam erupted at the court when news of the decisions trickled out. A huge crowd of gay-rights activists from around the country, gathered on the sidewalk in front of the court’s marble steps, cheered and chanted “DOMA is dead.” They twirled rainbow flags and broke out into an impromptu rendition of “America the Beautiful.” Across the street from the court, where a smaller cluster of anti-gay-marriage protesters was huddled, the reaction to the decisions was muted.