"No longer may this liberty be denied," said Justice Anthony Kennedy.
PHOTOS: Reactions to U.S. Supreme Court ruling on same sex marriage
The vote was narrow - 5-4 - but Kennedy's majority opinion was clear and firm: "The court now holds that same-sex couples may exercise the fundamental right to marry."
The ruling will put an end to same-sex marriage bans in the 14 states that still maintain them, and provide an exclamation point for breathtaking changes in the nation's social norms in recent years. As recently as last October, just over one-third of the states permitted gay marriages.
Kennedy's reading of the ruling elicited tears in the courtroom, euphoria outside and the immediate issuance of marriage licenses to same-sex couples in at least eight states. In Dallas, Kenneth Denson said he and Gabriel Mendez had been legally married in 2013 in California but "we're Texans; we want to get married in Texas."
In praise of the decision, President Barack Obama called it "justice that arrives like a thunderbolt."
Today is a big step in our march toward equality. Gay and lesbian couples now have the right to marry, just like anyone else. #LoveWins— President Obama (@POTUS) June 26, 2015
Four of the court's justices weren't cheering. The dissenters accused their colleagues of usurping power that belongs to the states and to voters, and short-circuiting a national debate about same-sex marriage.
"This court is not a legislature. Whether same-sex marriage is a good idea should be of no concern to us," Chief Justice John Roberts wrote in dissent. Roberts read a summary of his dissent from the bench, the first time he has done so in nearly 10 years as chief justice.
"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 said. "But do not celebrate the Constitution. It had nothing to do with it."
Justice Antonin Scalia said he was not concerned so much about same-sex marriage as "this court's threat to American democracy." He termed the decision a "judicial putsch." Justices Samuel Alito and Clarence Thomas also dissented.
Several religious organizations criticized the decision.
The U.S. Conference of Catholic Bishops said it was "profoundly immoral and unjust for the government to declare that two people of the same sex can constitute a marriage."
Kennedy said nothing in the court's ruling would force religions to condone, much less perform, weddings to which they object. And he said the couples seeking the right to marry should not have to wait for the political branches of government to act.
The 14th Amendment to the Constitution requires states to allow same-sex couples to marry on the same basis as heterosexuals, he said
"The dynamic of our constitutional system is that individuals need not await legislative action before asserting a fundamental right. The nation's courts are open to injured individuals who come to them to vindicate their own direct, personal stake in our basic charter," Kennedy wrote in his fourth major opinion in support of gay rights since 1996. It came on the anniversary of two of those earlier decisions.
"No union is more profound than marriage," Kennedy wrote, joined by the court's four more liberal justices.
The stories of the people asking for the right to marry "reveal that they seek not to denigrate marriage but rather to live their lives, or honor their spouses' memory, joined by its bond," Kennedy said.
As he read his opinion, spectators in the courtroom wiped away tears when the import of the decision became clear. One of those in the audience was James Obergefell, the lead plaintiff in the Supreme Court fight.
Outside, Obergefell held up a photo of his late spouse, John Arthur, and said the ruling establishes that "our love is equal." He added, "This is for you, John."
Obama placed a congratulatory phone call to Obergefell, which he took amid a throng of reporters outside the courthouse.
Speaking a few minutes later at the White House, Obama praised the decision as an affirmation of the principle that "all Americans are created equal."
The crowd in front of the courthouse at the top of Capitol Hill grew in the minutes following the ruling. The Gay Men's Chorus of Washington, D.C., sang the "Star-Spangled Banner." Motorists honked their horns in support as they passed by the crowd, which included a smattering of same-sex marriage opponents.
The ruling will not take effect immediately because the court gives the losing side roughly three weeks to ask for reconsideration. But county clerks in Alabama, Georgia, Mississippi, Ohio, North Dakota, South Dakota, Tennessee and Texas began issuing licenses to same-sex couples within hours of the decision.
The cases before the court involved laws from Kentucky, Michigan, Ohio and Tennessee that define marriage as the union of a man and a woman. Those states have not allowed same-sex couples to marry within their borders, and they also have refused to recognize valid marriages from elsewhere.
Just two years ago, the Supreme Court struck down part of the federal anti-gay marriage law that denied a range of government benefits to legally married same-sex couples.
Justices Stephen Breyer, Ruth Bader Ginsburg, Elena Kagan and Sonia Sotomayor formed the majority with Kennedy on Friday, the same lineup as two years ago.
The earlier decision in United States v. Windsor did not address the validity of state marriage bans, but courts across the country, with few exceptions, said its logic compelled them to invalidate state laws that prohibited gay and lesbian couples from marrying.
There are an estimated 390,000 married same-sex couples in the United States, according to UCLA's Williams Institute, which tracks the demographics of gay and lesbian Americans. Another 70,000 couples living in states that do not currently permit them to wed would get married in the next three years, the institute says. Roughly 1 million same-sex couples, married and unmarried, live together in the United States, the institute says.
The Obama administration backed the right of same-sex couples to marry. The Justice Department's decision to stop defending the federal anti-marriage law in 2011 was an important moment for gay rights, and Obama declared his support for same-sex marriage in 2012.
The states affected by Friday's ruling are Alabama, Arkansas, Georgia, Kentucky, Louisiana, Michigan, Mississippi, most of Missouri, Nebraska, North Dakota, Ohio, South Dakota, Tennessee and Texas.
nt's decision to stop defending the federal anti-marriage law in 2011 was an important moment for gay rights, and Obama declared his support for same-sex marriage in 2012.