People celebrate outside the Supreme Court in Washington, D.C. on June 26, 2015 after its historic decision on gay marriage. National Journal

Same-sex couples must be allowed to marry in every state, the Supreme Court said in a 5-4 ruling Friday.

The Court's decision wasn't especially surprising—legal experts on both sides of the issue had seen the writing on the wall for a while now—but it will nevertheless be remembered as one of the defining civil rights cases in the Court's history and as an enormous leap forward for gay rights.

"The nature of marriage is that, through its enduring bond, two persons together can find other freedoms, such as expression, intimacy, and spirituality. This is true for all persons, whatever their sexual orientation," Justice Anthony Kennedy wrote in the majority's opinion.

Kennedy's decision is a full-throated, unqualified defense of the right to same-sex marriage, heavy with references to the dignity conferred by marriage. He wrote that laws prohibiting same-sex marriage are unfair to gay couples and to the children they raise.

"No union is more profound than marriage, for it embodies the highest ideals of love, fidelity, devotion, sacrifice, and family. In forming a marital union, two people become something greater than once they were," Kennedy wrote. "It would misunderstand these men and women to say they disrespect the idea of marriage. Their plea is that they do respect it, respect it so deeply that they seek to find its fulfillment for themselves. "¦ They ask for equal dignity in the eyes of the law. The Constitution grants them that right."

Before the Court's ruling Friday, 36 states and Washington, D.C., allowed same-sex couples to marry.

In most of those states, same-sex marriage was legalized by the federal courts—most frequently, in rulings handed down after the Supreme Court struck down a key part of the Defense of Marriage Act, the federal law that had denied marriage benefits to same-sex couples.

That ruling, handed down almost exactly two years ago, opened the floodgates for a spate of lower-court rulings holding that state bans on same-sex marriage were unconstitutional.

Marriage-equality advocates have been working slowly toward the Supreme Court for decades, building up a record of legislative success in the states and legal challenges in lower courts, both of which coincided with a dramatic reversal in public opinion.

All of those factors helped lay the groundwork for an eventual Supreme Court ruling. If advocates had misjudged their timing, today's ruling could have set the campaign back by several years.

Ultimately, though, the Court was ready to take that last step.

"The limitation of marriage to opposite-sex couples may long have seemed natural and just, but its inconsistency with the central meaning of the fundamental right to marry is now manifest," Kennedy wrote. "With that knowledge must come the recognition that laws excluding same-sex couples from the marriage right impose stigma and injury of the kind prohibited by our basic charter."

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.