The gay marriage fight in America is over.

In a 5-4 decision that was largely anticipated, the Supreme Court ruled that states must allow gay marriages and are obligated to recognize gay marriages performed elsewhere.

RELATED: Complete coverage of the gay marriage ruling

The historic decision was cemented in just one paragraph, but followed years of court battles between those who sought to legalize same-sex marriage and others who believed the law should recognize only marriage between a man and a woman.

"The Fourteenth Amendment requires a State to license a marriage between two people of the same sex and to recognize a marriage between two people of the same sex when their marriage was lawfully licensed and performed out-of-State," Justice Anthony Kennedy wrote in the lengthy opinion.

With that decision, the court handed the left its second major policy win in as many days, by deciding that same-sex marriage in America is a constitutional right that cannot be limited by the states. It followed Thursday's case upholding a key section of Obamacare.

It's a generational shift from the high court, which ruled in the early 1970s that marriage licenses can be denied to same-sex couples.

It's also a victory for gay rights advocates and their vocal Democratic supporters in Congress, many of whom have said their crusade to bolster the lesbian, gay, bisexual and transgendered community is akin to the civil rights movement of the 1960s.

"Today, the Supreme Court unequivocally affirmed that equal justice under the law means marriage equality for LGBT Americans," House Minority Leader Nancy Pelosi, D-Calif., said in a statement. "This decision is about creating a future where loving, committed families are able to live with dignity. This is about freedom. This is about love. This is transformative, not only for LGBT families, but for America."

Some of the most important supporters of their fight are very new to the fight themselves, showing how quickly politicians have turned on the issue of same-sex marriage. President Obama ran for the Senate in 2004 as a defender of traditional marriage. But by 2010, he said he was "evolving" on the issue, and two years later, he was a supporter.

Kennedy wrote that those seeking the right to marry into same-sex unions were unfairly denied the right, even as many states have change their laws in favor of gay marriage. Same-sex marriage is legal in 37 states, mostly due to courts overruling bans.

"There may be an initial inclination to await further legislation, litigation, and debate," Kennedy wrote in the decision, "But referenda, legislative debates, and grassroots campaigns; studies and other writings; and extensive litigation in state and federal courts have led to an enhanced understanding of the issue. While the Constitution contemplates that democracy is the appropriate process for change, individuals who are harmed need not await legislative action before asserting a fundamental right."

Each of the four justices who voted against the majority wrote a dissenting argument, including Justice Samuel Alito, who noted that same-sex marriage is not guaranteed in the constitution. The court, he argued, shouldn't be changing the law.

"Today's decision usurps the constitutional right of the people to decide whether to keep or alter the traditional understanding of marriage," Alito wrote. He also questioned what the option will mean for those who are religiously opposed to same-sex marriage.

The court does not extensively address whether clergy or other religious institutions will be legally able to refrain from performing gay marriages or otherwise recognizing them.

"I assume that those who cling to old beliefs will be able to whisper their thoughts in the recesses of their homes, but if they repeat those views in public, they will risk being labeled as bigots and treated as such by governments, employers, and schools," Alito wrote.

Chief Justice John Roberts also dissented, and worried that the Court was going too far by making law, not just interpreting law. "[T]his Court is not a legislature," he wrote.

Justice Antonin Scalia all but predicted that today's decision was coming in his dissent in the DOMA case. He said the Court believed DOMA was aimed at harming couples in same-sex marriages, and said, "How easy it is, indeed how inevitable, to reach the same conclusion with regard to state laws denying same-sex couples marital status."

The decision is the result of a shift in the Supreme Court that has become evident over the past few years. In 2013, the Court said the federal Defense of Marriage Act law, which defined marriage as a relationship between a man and a woman, was unconstitutional. The DOMA decision gave states the go-ahead to legalize same-sex marriage, and many did.

But the 2013 decision only dealt with how the federal government views same-sex marriage, and it quickly became apparent that the Court would soon be asked to decide the specific question of whether states are required to allow same-sex marriages.

Defendants in the case argued on behalf of Michigan, Tennessee, Ohio and Kentucky, where gay marriage bans were challenged in lower courts.

The petitioners in the case were gay couples from those states seeking the right to marry, or to have marriages sanctioned in one state recognized in another. Among the plaintiffs are a gay couple from Kentucky and a lesbian couple from Michigan who have been unable to adopt each other's children because same-sex marriages are not permitted in their states.

The defendants argued on behalf of those states that the states, and not the federal government, should be allowed to establish their own laws regarding marriage.

The legality of state laws banning same-sex marriage was one of the questions before the court this year, when justices started hearing arguments in the case in April. The other was whether states are legally mandated to recognize gay marriages sanctioned in other states. In both cases, the Court sided with those who favor same-sex marriage.

Lawyers in favor of allowing the four states to maintain bans told the court in April that the prohibition is not a form of discrimination, and instead is aimed at protecting the institution of marriage and families. Michigan assistant Attorney General John Bursch argued on behalf of the state that allowing gay marriage would weaken the institution and hurt families, citing an increase in out-of-wedlock births from 10 percent to 40 percent since 1970.

But United States Solicitor General Donald B. Verrilli argued that gay marriage should be a constitutional right, and his argument won the day. "This is about equal protection," Verrilli argued in April. "The justification for excluding gays and lesbians from this institution doesn't hold up."

The court's decision is also a defeat for Congressional Republicans, who mostly argued against legalizing gay marriage and argued on behalf of upholding DOMA.

Republicans Friday criticized the court's decision, even as many poll numbers show a majority of Americans now support same-sex marriage.

"All human beings are created equal by God and thus deserve to be treated with love, dignity and respect," House Speaker John Boehner, R-Ohio, said in a statement Friday. "I am, however, disappointed that the Supreme Court disregarded the democratically-enacted will of millions of Americans by forcing states to redefine the institution of marriage. My views are based on my upbringing and my faith. I believe that marriage is a sacred vow between one man and one woman, and I believe Americans should be able to live and work according to their beliefs."