In a 6-3 decision , the Supreme Court saved the controversial health care law that will define President Barack Obama's administration for generations to come.

The ruling holds that the Affordable Care Act authorized federal tax credits for eligible Americans living not only in states with their own exchanges but also in the 34 states with federal marketplaces. It staved off a major political showdown and a mad scramble in states that would have needed to act to prevent millions from losing health care coverage.

"Five years ago, after nearly a century of talk, decades of trying, a year of bipartisan debate, we finally declared that in America, health care is not a privilege for a few but a right for all," Obama said from the White House. "The Affordable Care Act is here to stay"

In a moment of high drama, Chief Justice John Roberts sent a bolt of tension through the Court when he soberly announced that he would issue the majority opinion in the case. About two-thirds of the way through his reading, it became clear that he again would be responsible for rescuing Obamacare.

JUST WATCHED Supreme Court upholds Obamacare subsidies Replay More Videos ... MUST WATCH Supreme Court upholds Obamacare subsidies 01:19

"Congress passed the Affordable Care Act to improve health insurance markets, not to destroy them," Roberts wrote in the majority opinion. "If at all possible, we must interpret the Act in a way that is consistent with the former, and avoids the latter."

He was joined by Justice Anthony Kennedy -- who is often the Court's swing vote -- and the four liberal justices. Justice Antonin Scalia wrote the dissent, joined by Justices Clarence Thomas and Samuel Alito.

When he finished, Roberts announced that Scalia would read a dissent.

"Indeed," the veteran justice replied, sparking laughter in the Court and offering a preview of the stinging repudiation of the majority opinion he was about to unfurl.

'Interpretative jiggery-pokery'

Seated right next to the Chief Justice, Scalia proceeded to eviscerate his reasoning. He reeled off a string of unflattering descriptions about the ruling, calling it "wonderfully convenient," complaining about "interpretative jiggery-pokery" and arguing it was not the Court's job to make up for the sloppy drafting of the law by Congress.

Roberts heard the dissent throughout without giving a visible reaction until Scalia quipped that the law should be called SCOTUScare, causing the Chief Justice to chuckle and sending laughter through the public galleries.

Challengers to the law argued that the federal government should not be allowed to continue doling out subsidies to individuals living in states without their own health insurance exchanges and a ruling in their favor would have cut off subsidies to 6.4 million Americans, absent a congressional fix or state action.

The ruling is a huge victory for President Barack Obama, who nearly saw four words in the Affordable Care Act throw his signature achievement into chaos.

"By focusing on the text and structure of the statute, as opposed to the IRS's interpretation of the statute, today's decision means that the next President can't just undo federal exchanges. Instead, it will take an Act of Congress—and a President willing to sign it—to thwart the heart of Obamacare," said Steve Vladeck, a CNN contributor and law professor at American University.

Subsidies

JUST WATCHED Obama: Health care law is here to stay Replay More Videos ... MUST WATCH Obama: Health care law is here to stay 01:39

The income-based subsidies are crucial to the law's success, helping to make health insurance more affordable and ultimately reducing the number of uninsured Americans, and shutting off the subsidy spigot to individuals in the 34 states that rely on exchanges run by the federal government would have upended the law.

Congress would have had to amend the Affordable Care Act to fix its language that subsidies would be available only to those who purchase insurance on exchanges "established by the state" -- a politically treacherous and likely untenable action in a Republican Congress. Alternatively, governors in the 34 states without their own exchanges, most of them Republicans, would have had to establish their own exchanges -- another tough ask.

Roberts, writing for the majority, said while the contentious phrase was ambiguous, its meaning in context of the law as a whole was clear.

"The context and structure of the Act compel us to depart from what would otherwise be the most natural reading of the pertinent statutory phrase," Roberts wrote.

The conservative Chief Justice was once again an unlikely hero in saving Obama's signature legislative achievement. He took heat from conservatives in 2012 when he first saved the law from a major constitutional challenge in a decision that stunned pundits and politicos across the ideological spectrum.

2016

Republican presidential candidates quickly denounced the ruling.

JUST WATCHED Marco Rubio: Obamacare is bad for America Replay More Videos ... MUST WATCH Marco Rubio: Obamacare is bad for America 01:06

"I disagree with the Court's ruling and believe they have once again erred in trying to correct the mistakes made by President Obama and Congress in forcing Obamacare on the American people," said Florida Sen. Marco Rubio. "I remain committed to repealing this bad law and replacing it with my consumer-centered plan that puts patients and families back in control of their health care decisions."

Former Florida Gov. Jeb Bush said he was "disappointed" by the ruling."

"But this decision is not the end of the fight against Obamacare," he said. "As President of the United States, I would make fixing our broken health care system one of my top priorities."

Democratic presidential frontrunner Hillary Clinton took to Twitter to praise the decision.

"Yes!" she tweeted. "SCOTUS affirms what we know is true in our hearts & under the law: Health insurance should be affordable & available to all."

Just 16 states and the District of Columbia have set up their own health insurance marketplaces, which left millions of residents in the 34 states that rely on exchanges run by the federal government vulnerable to the Supreme Court's ruling.

Challengers had argued that the words "established by the State" clearly barred the government from doling out subsidies in the 34 states without their own healthcare marketplaces.

They said that Congress limited the subsidies in order to encourage the states to set up their own exchanges and when that failed on a large scale, the IRS tried to "fix" the law.

"If the rule of law means anything, it is that text is not infinitely malleable, and that agencies must follow the law as written—not revise it to 'better achieve' what they assume to have been Congress's purposes," wrote Michael Carvin, an attorney for the challengers.

But it was Solicitor Generald Donald B. Verrilli, Jr. who won over the justices, arguing that Congress always intended the subsidies be available to everyone -- regardless of the actions of their state leaders.

Verrilli warned in court briefs that if the challengers prevailed, the states with federally-run exchanges "would face the very death spirals the Act was structured to avoid and insurance coverage for millions of their residents would be extinguished."

Lower courts had split on the issue. The U.S. Court of Appeals for the District of Columbia invalidated the IRS rule while the Fourth Circuit Court of Appeals ruled in favor of the Obama administration.