The Supreme Court ruled 5-4 on Friday that state bans on same-sex marriage are unconstitutional, an historic decision that extends gay and lesbian nuptials nationwide.

Justice Anthony Kennedy, authoring the majority opinion, wrote that “The Court now holds that same-sex couples may exercise the fundamental right to marry. No longer may this liberty be denied to them.”

Kennedy also rejected opponents’ arguments that the issue should be left for voters or state legislatures to decide, writing that “the dynamic of our constitutional system is that individuals need not await legislative action before asserting a fundamental right.”

Chief Justice John Roberts, along with Samuel Alito, Antonin Scalia and Clarence Thomas, dissented.

“If you are among the many Americans — of whatever sexual orientation — who favor expanding same-sex marriage, by all means celebrate today’s decision,” Roberts wrote in his dissent. “Celebrate the achievement of a desired goal. Celebrate the opportunity for a new expression of commitment to a partner. Celebrate the availability of new benefits. But do not celebrate the Constitution. It had nothing to do with it.”

The question before the justices in the case of Obergefell vs. Hodges was whether the 14th Amendment’s guarantee of equal protection and due process require a state to license a marriage between two people of the same sex.

The justices also were considering the question of whether a state is required to recognize a same-sex couple’s legal marriage performed out-of-state. That requirement, obviously, was part of the majority ruling.

Kennedy cited the equal protection and due process clauses of the 14th Amendment in finding same-sex marriage bans unconstitutional. He wrote that “especially against a long history of disapproval of their relationships, this denial to same-sex couples of the right to marry works a grave and continuing harm. The imposition of this disability on gays and lesbians serves to disrespect and subordinate them.”

He cited the array of rights and benefits that come with state recognition of marriages, as well as what it means to couples who are raising children.

“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.”
Opponents have cast same-sex marriage as redefining an institution in place for thousands of years, but Kennedy’s opinion cited the history of marriage as one of “continuity and change,” like the abandonment of arranged marriages and the law of coverture.

Outside the court, a large crowd gathered on the plaza of the court, waving rainbow flags and those of the Human Rights Campaign and, at one moment, singing the National Anthem.

The named plaintiff in the case, Jim Obergefell, of Cincinnati, sued the state of Ohio in July 2013 along with his partner John Arthur after they were married in Maryland, which recognizes same-sex marriage. The issue was whether the state would list Obergefell as Arthur’s surviving spouse on his death certificate. Arthur, suffering from ALS, died that October.

The 6th Circuit Court of Appeal ruled in November that Ohio’s ban on same-sex marriage did not violate the constitution, making the case ripe for Supreme Court review as the decision conflicted with the opinions of other appellate courts. The Obergefell case was consolidated with three others, including challenges to same-sex marriage restrictions in Tennessee, Michigan and Kentucky.

“I know in my heart John is with me today,” he said on the steps of the court, at one point holding up a photo of Arthur.

He added, “It is my hope that the term ‘gay marriage’ will soon be a thing of the past, that it will simply be known as ‘marriage.'” President Obama called him on his cell phone, telling Obergefell that “your leadership has changed the country.”

Scalia wrote a dissent that attacked the majority’s recognition of a right to intimacy. He wrote that “the opinion’s showy profundities are often profoundly incoherent.”

He cited a line in the majority opinion: “The nature of marriage is that, through its enduring bond, two persons together can find other freedoms, such as expression, intimacy, and spirituality.”

Scalia wrote, “Really? Who ever thought that intimacy and spirituality [whatever that means] were freedoms? And if intimacy is, one would think Freedom of Intimacy is abridged rather than expanded by marriage. Ask the nearest hippie. Expression, sure enough, is a freedom, but anyone in a long-lasting marriage will attest that that happy state constricts, rather than expands, what one can prudently say.”

In his close, Kennedy wrote, in the majority opinion, “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. As some of the petitioners in these cases demonstrate, marriage embodies a love that may endure even past death.

“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. Their hope is not to be condemned to live in loneliness, excluded from one of civilization’s oldest institutions. They ask for equal dignity in the eyes of the law. The Constitution grants them that right.”

Up to now, 37 states had recognized same-sex marriage, either through court decision or via legislative action. The decision now sets the stage for remaining states to start issuing marriage licenses to same-sex couples, although some political and religious leaders have vowed resistance.

Kennedy authored two other landmark rulings on LGBT equality — Lawrence vs. Texas in 2003, and U.S. vs. Windsor in 2013 — and there was some expectation that he would author this one. Both of those decisions also were released on June 26, which raised speculation that the court would issue its ruling on Friday.

Although the decision is a turning point in the LGBT movement, activists have said that their focus next will be on anti-discrimination laws in nearly 30 states as well as at the federal level. The ruling did not identify gay and lesbian men and women as a “suspect” class of individuals, but more simply that their ability to get married was a fundamental right. Had the court used the rationale of a “suspect” class, it could have had an impact on other areas like housing and employment.

But the decision still could give plaintiffs new momentum in areas like family law, as well as laws over adoption rights. LGBT groups have said that they are likely to pursue a comprehensive anti-discrimination law at the federal level, with the decision giving them an even stronger case for the need for such protections.

“I don’t think any law that discriminates in any way against gay men and lesbians can stand in the face of this decision,” said Ted Boutrous, attorney for Gibson Dunn & Crutcher who was part of the legal team that challenged California’s Proposition 8. He predicted that the ruling would be a “significant catalyst” for anti-discrimination legislation.

“The opinion is so powerful and sweeping,” he said.

At the White House, Obama acknowledged what was suggested in Kennedy’s opinion — that public sentiment has shifted significantly in recent years, after decades in which gay and lesbian activists had sought even basic legal protections.

“Sometimes, there are days like this, when that slow, steady effort is rewarded with justice that arrives like a thunderbolt,” Obama said from the Rose Garden. The White House even changed its Twitter logo, painting the Executive Mansion in rainbow hues.

Obama’s presidency is likely to be recognized for dramatic steps forward in LGBT rights, not just in the court decisions but in the repeal of the military’s Don’t Ask, Don’t Tell policy.

Still, his administration is being pressed on other issues.

Several groups are highlighting the detainment and deportation of transgender undocumented immigrants. On Wednesday, Obama was interrupted by a heckler as he delivered remarks in the East Room during the White House’s annual LGBT Pride Month reception.

On Friday, however, the mood among administration staffers was celebratory. Betsey Stevenson, a member of the Council of Economic Advisers, tweeted a photo from last week, of a double rainbow over the White House.

Political strategist Hilary Rosen, a longtime advocate of LGBT  rights, said that when she heard the ruling, “I thought about all of the people I who knew who died during the AIDS crisis thinking the government would never protect them.” She also said that she realized its impact when “my daughter said, ‘Wow mom, our family is finally equal.'”