The Supreme Court’s ruling Friday that same-sex couples could get married no matter where they live was the culmination of two remarkable waves that have spread across the country in recent years: The swell of courts striking down state bans on same-sex marriage and the surge in public support for such marriages.

Still, even as public opinion has shifted and courts have acted, the high court’s 5 to 4 ruling was a historic and narrow victory for gay rights. The court’s four most conservative members dissented, and each of them wrote a separate opinion decrying the decision.

Here is how each justice wound up landing on the issue. (Read the opinion and the dissents here.)

The majority opinion

Justice Anthony Kennedy wrote the majority opinion, and was joined by the court’s four liberal justices: Ruth Bader Ginsburg, Stephen G. Breyer, Sonia Sotomayor and Elena Kagan.

“No union is more profound than marriage, for it embodies the highest ideals of love, fidelity, devotion, sacrifice, and family,” Kennedy wrote. “In forming a marital union, two people become something greater than once they were. As some of the petitioners in these cases demonstrate, marriage embodies a love that may endure even past death.”

During the oral arguments in April, two of these other justices — Sotomayor and Breyer — stated that marriage was a fundamental, constitutional right. Kennedy, meanwhile, who was viewed as the swing vote, quickly brought up the idea of how marriage has been defined for so long. “The word that keeps coming back to me is ‘millennia,’ ” he said at the time.

In the majority opinion, Kennedy again pointed to the idea that marriage was such a longstanding part of humanity, but he framed that differently, pointing out that the men and women who wanted the right to get married were only seeking to join this institution.

“Their hope is not to be condemned to live in loneliness, excluded from one of civilization’s oldest institutions,” he wrote. “They ask for equal dignity in the eyes of the law. The Constitution grants them that right.”

The Supreme Court ruled, 5 to 4, that same-sex marriage bans are unconstitutional. Here's what you need to know. (Gillian Brockell/The Washington Post)

Chief Justice John G. Roberts Jr.

For the first time in his decade as chief justice, Roberts read a dissenting opinion from the bench. His dissent was particularly biting, one that pilloried the majority for what he stated was an unconstitutional, unprecedented “act of will, not legal judgment.”

Roberts quickly and bluntly stated that while arguments of social fairness and equality have “undeniable appeal,” he thought the court was out of its element in trying to decide this issue.

“[T]his court is not a legislature,” he wrote. “Whether same-sex marriage is a good idea should be of no concern to us. Under the Constitution, judges have power to say what the law is, not what it should be.”

He left little doubt that he thought the five justices in the majority were overreaching, calling the court’s decision to order marriage licenses in every state an “extraordinary step.” He said that many people would celebrate this, and he wrote that he did not begrudge anyone their victory or access to new benefits. But he was extremely critical of what he called “the majority’s extravagant conception of judicial supremacy.”

His explanation for why he feels the court overreached is worth quoting in full here:

Supporters of same-sex marriage have achieved considerable success persuading their fellow citizens—through the democratic process—to adopt their view. That ends today. Five lawyers have closed the debate and enacted their own vision of marriage as a matter of constitutional law. Stealing this issue from the people will for many cast a cloud over same-sex marriage, making a dramatic social change that much more difficult to accept.

Roberts returns again and again to the idea of the five justices acting without regard for precedent or the proper role of a judiciary, casting the majority’s decision as one that upends an understanding of marriage that has persisted for, as Kennedy noted, millennia.

As he puts it at one point: “Just who do we think we are?”

Roberts was joined by Scalia and Thomas. 

Justice Antonin Scalia

As expected, Scalia’s dissent was the fieriest, needing just two sentences to say that the majority’s decision is a “threat to American democracy.” He later says the majority opinion lacks “even a thin veneer of law,” blasting it as essentially taking a policy position on something he says should be left to the people to decide.

While Scalia says the actual substance of the opinion is immaterial — “The law can recognize as marriage whatever sexual attachments and living arrangements it wishes,” he writes — he says what bothers him is the way this edict was handed down by “a majority of the nine lawyers on the Supreme Court.”

Scalia describes the public debate over marriage, one that requires arguments and votes and legislation, as being the way the government should work. Instead, Scalia said that the “naked judicial claim to legislative — indeed, super-legislative — power” (emphasis his) is not in keeping with the country’s system of government.

“A system of government that makes the people subordinate to a committee of nine unelected lawyers does not deserve to be called a democracy,” he wrote.

In his dissent, Scalia calls the decision a “judicial Putsch,” says it is delivered in a style “as pretentious as its content is egotistic” and — at one point — follows a quote from the majority opinion with “Really?” and another with “Huh?”

In a footnote, Scalia says that if he ever joined an opinion that opens the way the majority opinion does, “I would hide my head in a bag.” He then adds: “The Supreme Court of the United States has descended from the disciplined legal reasoning of John Marshall and Joseph Story to the mystical aphorisms of the fortune cookie.” Scalia was not a fan.

Scalia was joined by Thomas.

Justice Clarence Thomas

Thomas wrote that he could not agree with a decision that, in his view, inverted the relationship between a person and the government, because he said the majority’s decision suggested that human dignity can only come from that government.

He warned that what he saw as the majority opinion’s misunderstanding of liberty — which he said was really freedom from the government, rather than access to government benefits — “will likely cause collateral damage to other aspects of our constitutional order that protect liberty.”

Thomas also wrote of “potentially ruinous consequences for religious liberty.” He went on to say that while he feels the majority’s thoughts are misguided, he believes they cannot affect the dignity of people demeaned by it, which he termed as anyone who voted for laws defining marriage as between one man and one woman.

Thomas was joined by Scalia.

Justice Samuel A. Alito Jr.

Alito’s dissent touches on the idea of marriage as a union meant to benefit the well-being of the people getting married. While he notes that many people share that view, he quickly notes that “it is not the traditional” understanding of marriage.

“For millennia, marriage was inextricably linked to the one thing that only an opposite-sex couple can do: procreate,” he wrote.

The idea of marriage as something fundamentally predicated on conceiving children was raised during the oral arguments, but Breyer pushed back on this idea, noting that many heterosexual couples will not have children. In his dissent, Alito acknowledged that in the modern era, “the tie between marriage and procreation has frayed.” He pointed to the number of babies born to unmarried mothers, which he said “is both a cause and a result of changes in our society’s understanding of marriage.”

Still, Alito framed his dissent as one worried about the majority’s “abuse of its authority.” And he went on to say that that everyone — no matter how they feel about marriage — should be worried about the precedent set by the narrow ruling.

“If a bare majority of Justices can invent a new right and impose that right on the rest of the country, the only real limit on what future majorities will be able to do is their own sense of what those with political power and cultural influence are willing to tolerate,” he wrote. “Even enthusiastic supporters of same-sex marriage should worry about the scope of the power that today’s majority claims.”

Alito was joined by Scalia and Thomas. 

RELATED:

Understanding key lines from the decision and dissents

The big excerpts on religious liberty from the decision

Map: Same-sex marriage in the United States