The court ruled Friday that the U.S. Constitution gives gay people the right to marry in all 50 states and that to deny them that right would be a violation of the 14th Amendment.
In a 5-4 decision released Friday, the court ruled that the amendment obliges states to license marriages between people of the same sex, and to recognize marriages lawfully performed outside of state.
Obama called the decision a "victory for America" and said it "affirms what millions of Americans believe in their hearts."
"When everyone is treated equally, we are all more free," he said.
He praised the perseverance of those who have fought for gay rights and marriage equality for decades "and slowly made an entire country realize that love is love."
"Change must have seemed so slow for so long," Obama said. "But compared to so many other issues, America's shift has been so quick."
Equal protection for all
The 14th Amendment affords equal protection under the law to all citizens and was key in other landmark decisions on racial and gender discrimination and reproductive rights, such as Brown v. Board of Education, and Roe v. Wade.
The top court ruled it would be a violation of the amendment to grant marriage rights only to heterosexual couples.
"No union is more profound than marriage, for it embodies the highest ideals of love, fidelity, devotion, sacrifice and family. ... [The challengers] ask for equal dignity in the eyes of the law. The Constitution grants them that right," Justice Anthony Kennedy wrote in the majority opinion.
Obama welcomed the decision with a tweet and a phone call to the lead plaintiff in the case, James Obergefell.
"I'm really proud of you and just know that not only did you set a great example for people but you're also going to bring about lasting change in this country," he told him a call carried live on CNN.
The White House turned the icon of the White House building on its Twitter page to rainbow colours in celebration of the ruling and had an image of giant flying rainbow flag in its home page.
Gay marriage is already legal in 37 of the 50 states (and the District of Columbia), and Friday's ruling means the other states will also have to allow it and recognize existing marriages performed in other jurisdictions.
In its ruling, the court said the "long history of disapproval of their relationships" and the denial of the right to marry has done a "grave and continuing harm" to same-sex couples.
"The imposition of this disability on gays and lesbians serves to disrespect and subordinate them," Kennedy wrote in the majority opinion. "And the equal protection cause, like the due process clause, prohibits this unjustified infringement of the fundamental right to marry."
Justice Antonin Scalia, one of four dissenting votes, wrote a scathing dissenting opinion, calling the decision a" threat to American democracy" and ridiculing the flowery language of the majority opinion.
"If, even as the price to be paid for a fifth vote, I ever joined an opinion for the court that began: 'The Constitution promises liberty to all within its reach, a liberty that includes certain specific rights that allow persons, within a lawful realm, to define and express their identity,' I would hide my head in a bag," Scalia wrote.
"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."
The court was examining two key questions:- Whether states can ban same-sex marriage.
- Whether states with gay marriage bans can refuse to recognize marriages performed in other jurisdictions where same-sex marriage is legal.
The plaintiffs had argued that the court had already acknowledged marriage is a fundamental right in previous decisions and that they were merely seeking equal access to this right.
The challenge of state bans on gay marriage before the court joined together the cases of Obergefell, April DeBoer, Jayne Rowse, Ijpe DeKoe and Thomas Kostura.
DeKoe and Kostura legally married in New York but then moved to Tennessee, where their marriage wasn't recognized.
Obergefell legally married his partner of 20 years, John Arthur, in Maryland, but was not recognized as his legal spouse when Arthur died a few months later in Ohio.
DeBoer and Rowse have three children together but were prevented from jointly adopting them or having them covered under each other's health insurance because they are not legally married, and can't get married because their home state of Michigan doesn't recognize same-sex marriage.
Previous ruling struck down
The court had previously struck down a provision of the Defence of Marriage Act that defined marriage as a union between a woman and man, and thus prevented same-sex couples married in states where such unions are legal from accessing certain federal programs and filing tax returns as a married couple, for example.
In that 2013 decision, the court reasoned that since states regulate marriage, the federal government can't refuse to recognize marriages that some states have deemed legal just because it doesn't approve of them.
In the wake of that decision, known as United States v. Windsor, the number of states that recognize same-sex marriage has grown from 12 to 37 and the District of Columbia, according to figures from the National Conference of State Legislatures.Suggest a correction