Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The U.S. Supreme Court on Friday made marriage for same-sex couples legal nationwide, declaring that refusing to grant marriage licenses to gay and lesbian couples violates the Constitution.

The landmark ruling will produce the most significant change in laws governing matrimony since the court struck down state bans on inter-racial marriage almost 50 years ago.

The majority opinion in the 5-4 decision was written by Justice Anthony Kennedy.

"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. "As some of the petitioners in these cases demonstrate, marriage embodies a love that may endure even past death."

Related: Supreme Court Gay Marriage Ruling: The Highlights

Kennedy went on to speak directly to the type of criticism that often comes from conservatives in pushing back against marriage equality.

"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," Kennedy wrote. "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."

A total of 36 states now permit gay couples to get married, covering roughly 70 percent of the US population. Today's ruling means the bans must end in the other 14 states — Alabama, Arkansas, Georgia, Kentucky, Louisiana, Michigan, Mississippi, Missouri, Nebraska, North Dakota, Ohio, South Dakota, Tennessee and Texas.

President Barack Obama, speaking from the White House just after the ruling, called the decision a "victory for America."

"When all Americans are treated as equal we are all more free," the president said.

After sundown on Friday, the White House celebrated the ruling by projecting rainbow-colored lights onto the house's exterior.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Obama's own views on the matter of same-sex marriage have evolved and he has pushed increasingly for issues of gay rights in his second term.

From the White House Rose Garden, he said that social progress sometimes is slow, “and then there are days like this, when that slow, steady effort is rewarded with justice that arrives like a thunderbolt.”

Those at the heart of the case said they recognized the historical significance of the decision.

“Today’s ruling affirms what millions of people across this country already know to be true in our hearts: Our love is equal” Jim Obergefell, the lead plantiff in the landmark case said outside of the Supreme Court after the ruling. “It is my hope that the term gay marriage will soon be a thing of the past. It will simply be marriage. And our nation will be better for it.”

The president called Obergefell to congratulate him shortly after the decision was announced. Obergefell took the call while he was being interviewed live on CNN.

“Your leadership on this changed the country,” Obama told him.

The decision capped a remarkably quick turnaround in public and judicial acceptance of same-sex marriage. In the past 18 months, court rulings struck down marriage bans in rapid succession — nearly 60 separate decisions in more than half the states.

Related: 'Historic Victory': Reactions to Supreme Court's Gay Marriage Ruling Pour In

Today's ruling overturned a decision from the Sixth Circuit Court of Appeals in Cincinnati, which said states had legitimate reasons for maintaining the traditional definition of marriage. The appeals court also said it would be better "to allow change through the customary political processes" instead of the courts.

Public opinion has shifted dramatically in recent years. The first Gallup poll on the subject showed only 27 percent approval for same-sex marriage in 1996. Gallup's most recent poll, taken last month, showed 60 percent approval.

Writing for the dissent, Chief Justice John Roberts said that while he recognizes that many will applaud the decision, "for those who believe in a government of laws, not of men, the majority's approach is deeply disheartening."

"This universal definition of marriage as the union of a man and a woman is no historical coincidence. Marriage did not come about as a result of a political movement, discovery, disease, war, religious doctrine, or any other moving force of world history — and certainly not as a result of a prehistoric decision to exclude gays and lesbians," Roberts wrote. "It arose in the nature of things to meet a vital need: ensuring that children are conceived by a mother and father committed to raising them in the stable conditions of a lifelong relationship."

Outside of the court, people sang "The Star-Spangled Banner" as the decision came out.

People spilled into the street in front of the Supreme Court building and across the roadway. Initially, police asked people to move back onto the sidewalk, but eventually let them spill out into one lane in front of the court. Passing police cars honked as people cheered and waved little blue flags with yellow equal signs.

Crystal Hardin of Arlington, Va. brought her three and five-year old kids.

"I decided to come out because I've been a long time supporter of marriage equality and I brought the kids because I figured the decision would go this way and I wanted them to be here," Hardin said. "I feel like in the future it will be important for them to know that they were here, we were supporting it, and you know, I don't know how they'll grow up."

RELATED: 2016 Candidates React to Gay Marriage Ruling

The Supreme Court's decision to strike down all gay marriage bans will also force conservative Christians and Republican political leaders to make two critical decisions.

Will they acquiesce to this ruling, or continue to oppose gay marriage and fight to reverse this decision the way conservatives have battled against Roe v. Wade and abortion rights for a generation? And how they will they respond on other issues that involve the rights of lesbian, gay, bi-sexual and transgender Americans, such as allowing gay men to lead Boy Scout troops?

Related: How Will Conservatives Respond to Gay Marriage Ruling?

Republican 2016 candidates slammed the decision, with reactions ranging from dire warnings about the future of religious liberty to calls for mutual respect.

Republican presidential candidate Gov. Bobby Jindal of Louisiana, an outspoken opponent of gay marriage, said in a lengthy statement that the decision "will pave the way for an all out assault against the religious freedom rights of Christians who disagree with this decision."

"The Supreme Court decision today conveniently and not surprisingly follows public opinion polls, and tramples on states' rights that were once protected by the 10th Amendment of the Constitution," Jindal said. "Marriage between a man and a woman was established by God, and no earthly court can alter that."