WASHINGTON — The U.S. Supreme Court handed President Barack Obama a major victory Thursday by upholding tax subsidies crucial to his signature health care law, with Chief Justice John Roberts saying Congress clearly intended for them to be available in all 50 states.

The court ruled on a 6-3 vote that the 2010 Affordable Care Act, widely known as Obamacare, did not restrict the subsidies to states that establish their own online health care exchanges. It marked the second time in three years the high court ruled against a major challenge to the law brought by conservatives seeking to gut it.

“Congress passed the Affordable Care Act to improve health insurance markets, not to destroy them,” Roberts wrote in the court’s decision, adding that nationwide availability of the credits is required to “avoid the type of calamitous result that Congress plainly meant to avoid.”

Roberts was joined by fellow conservative Justice Anthony Kennedy and the court’s four liberal members in the majority.

The decision means the subsidies will remain not just in the 13 states that have set up their own exchanges and the three states that have state-federal hybrid exchanges, but also in the 34 states, including Maine, that use the exchange run by the federal government.

The exchanges are geared toward people who buy “individual” health insurance, instead of get coverage through work or the government.

The case centered on the tax subsidies offered under the law, passed by Obama’s fellow Democrats in Congress in 2010 over unified Republican opposition, that help low- and moderate-income people buy private health insurance. The exchanges are online marketplaces that allow consumers to shop among competing insurance plans.

In Maine, the ruling will leave subsidies in the hands of nearly 61,000 people. Almost 90 percent of the 68,000 residents who enrolled in health insurance under the law received subsidies to help them afford their monthly premiums. Without the financial leg up, the average premium would have shot up nearly 400 percent, from $88 to $425 per month, according to an analysis by the Kaiser Family Foundation.

“This is a tremendous victory for all of us. We are thrilled that Mainers will continue to have access to subsidies to make health insurance more affordable and accessible,” Emily Brostek, executive director of the advocacy group Consumers for Affordable Health Care, said in a statement. “Tens of thousands of hardworking Mainers will be helped by this decision. Without the subsidies, monthly insurance premiums are just too expensive for many people.”

The Maine Health Access Foundation, which coordinated enrollment outreach in Maine, applauded the court’s decision, saying “in some cases these subsidies have made health insurance affordable for the first time in people’s lives.”

People who can’t get affordable health insurance through their jobs and earn between 100 percent and 400 percent of the federal poverty level — between $23,850 and $95,400 per year for a family of four — are eligible for the subsidies.

The question before the justices was whether a four-word phrase in the expansive law saying subsidies are available to those buying insurance on exchanges “established by the state” has been correctly interpreted by the administration to allow subsidies to be available nationwide.

Roberts wrote that although the conservative challengers’ arguments about the plain meaning of the statute were “strong,” 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.”

U.S. Sen. Angus King released a statement Thursday cheering the Supreme Court’s decision.

“Today, more than 60,000 people in Maine and millions more across the country can breathe a sigh of relief that they still have access to the high-quality, affordable health insurance plans provided through the Affordable Care Act,” King said. “I applaud the Supreme Court’s decision and hope that we can finally put discussions about dismantling the law behind us, and instead, dedicate ourselves to making this law better for the millions of Americans who it helps every day.”

U.S. Rep. Chellie Pingree also weighed in on the Affordable Care Act ruling.

“I’m glad the Supreme Court did the right thing and protected health care coverage for millions of Americans,” Pingree said. “This is a case they should never have taken up. Opponents were trying to take a few words out of context to undermine the entire law. When the ACA was being written and passed, everybody — Republicans, Democrats, and the Congressional Budget Office alike — agreed that the subsidies would be available in all states. Only later did opponents change their mind.”

In light of the ruling, Congress must work together to fix some of the ACA’s “flaws” that have hurt low- and middle-income workers and employees of small businesses, U.S. Sen. Susan Collins said.

“These flaws include the harsh penalties under Obamacare for middle-income workers who earn extra money or get a raise in a given year and the disincentives for small businesses to hire additional employees,” she said in a statement. “These provisions need to be corrected — they discourage struggling workers from trying to earn more money and discourage small businesses from creating jobs.”

U.S. Rep. Bruce Poliquin said he would “continue to push for free market fixes to Obamacare that increase competition among health insurance companies, expand health care plan choices, lower costs, grow the economy, cover pre-existing conditions, and protect the vulnerable.”

Scalia dissents

Justice Antonin Scalia took the relatively rare step of reading a summary of his dissenting opinion from the bench.

In his reading of the statute, “it is hard to come up with a reason to use these words other than the purpose of limiting credits to state exchanges,” Scalia said.

“We really should start calling the law SCOTUScare,” he added, referencing the court’s earlier decision upholding the constitutionality of the law. SCOTUS is the acronym for the Supreme Court of the United States.

Conservative Justices Clarence Thomas and Samuel Alito joined Scalia’s dissent.

The ruling will come as a major relief to Obama as he seeks to ensure his legacy legislative achievement is implemented effectively and survives political and legal attacks before he leaves office in early 2017.

The current system will remain in place, with subsidies available in all 50 states. If the challengers had won, at least 6.4 million people in at least 34 states would have lost the subsidies, whose average value is $272 per month.

“The subsidies upheld today help patients afford health insurance so they can see a doctor when they need one and not have to wait until a small health problem becomes a crisis,” Dr. Steven Stack, president of the American Medical Association, said.

Rich Umbdenstock, head of the American Hospital Association, said the subsidies have allowed people to more easily seek care, calling the ruling “a significant victory.”

A loss for the Obama administration also could have had a broader impact on insurance markets by deterring younger, healthier people from buying health insurance, which would lead to premiums rising for older, less healthy people who need health care most, according to analysts.

The Democratic-backed law aimed to help millions of Americans who lacked adequate health insurance because they couldn’t afford coverage.

The Obama administration has hailed the law as a success, saying 16.4 million previously uninsured people have gained health insurance since it was enacted. About 26 million people are without health insurance, according to government figures.

Leading up to the high court’s ruling, Obama warned of far-reaching consequences of overturning a law that he said had become “woven into the fabric of America.” In a June 9 speech, Obama said taking away health insurance provided under the law to millions of people who need it the most “seems so cynical.”

Conservatives have fought Obamacare from its inception, calling it a government overreach and “socialized medicine.” Opponents repeatedly but unsuccessfully sought to repeal it in Congress and launched a series of legal challenges. In 2012, Roberts, a conservative appointed by Republican President George W. Bush, cast the deciding vote in a 5-4 decision that upheld the law on constitutional grounds, siding with the court’s four liberals.

The current case started as a long-shot legal challenge by conservative lawyers that oppose the law. Financed by a libertarian Washington group called the Competitive Enterprise Institute, the lawyers recruited four people from Virginia to be the plaintiffs. The lead plaintiff was a self-employed limousine driver named David King.

The plaintiffs said they were “deeply disappointed” with the ruling. The law “unfairly restricts the health insurance choices of millions of people, and it threatens their jobs as well,” they added.

A district court judge ruled for the government, as did the federal appeals court in Richmond, Virginia. But the Supreme Court then agreed to hear it.

The challengers said the four-word phrase in the law indicates that only people who have bought insurance on state-established exchanges qualify for the tax-credit subsidies.

The Obama administration, backed by the health care industry, said other provisions in the law made clear that Congress intended the subsidies to be available nationwide regardless of whether states set up their own exchanges or leave the task to the federal government.

BDN Health Editor Jackie Farwell contributed to this report.