A federal appellate court ruling threatens to raise the price of health insurance for millions of Americans who bought through HealthCare.gov. (Theresa Poulson/The Washington Post)

A panel of the U.S. Court of Appeals for the District of Columbia Circuit struck down a major part of the federal health-care law Tuesday, ruling that the insurance subsidies that help millions of Americans pay for coverage are illegal in three dozen states.

Less than two hours later, a panel of the U.S. Court of Appeals for the 4th Circuit, based in Richmond, handed down a contradictory ruling on the issue in a separate case, raising the possibility of yet another high-stakes battle over the law playing out before the Supreme Court.

The conflicting rulings give traction to the most serious current threat to the Affordable Care Act, which has been battered by a series of legal challenges since it was enacted four years ago. The dispute centers on whether the subsidies may be awarded in states that chose not to set up their own insurance marketplaces and instead left the task to the federal government.

About 5.4 million people had signed up for coverage on the federal exchange as of this spring, federal figures show. About 87 percent of them received subsidies.

The Obama administration said it will ask the full D.C. Circuit court to review the decision in the District case, Halbig v. Burwell. The ruling will not have an immediate effect on consumers, because the judges allowed time for an appeal, and administration officials stressed that people receiving the subsidies will continue to do so as the cases are sorted out in the courts.

Now, nearly 3.3 million people have enrolled in a health plan between Oct. 1 and Feb. 1.

“We feel very strong about the sound legal reasoning of the argument that the administration is making,” White House spokesman Josh Earnest said. “You don’t need a fancy legal degree to understand that Congress intended for every eligible American to have access to tax credits that would lower their health-care costs regardless of whether it was state officials or federal officials who are running the marketplace.”

If the decision going against the government it upheld, it will be more damaging to the law than a Supreme Court decision last month that limited coverage of contraceptives.

In his dissent, D.C. Circuit Judge Harry T. Edwards noted that the subsidies case went to the core of the law, calling it a “not-so-veiled attempt to gut the Patient Protection and Affordable Care Act.”

Conservatives have spent years laying the groundwork for the challenge, which they considered their last, best chance at hollowing out the federal program. Activists had lobbied state legislatures, urging them not to set up their own marketplaces in part to magnify the effect if the courts ruled their way. Four cases have been moving through the courts relying on a similar rationale, among them the D.C. and Richmond cases.

The suits argued that Congress intended for the subsidies — in the form of tax credits — to go only to people in states that set up their own insurance exchanges, also referred to as marketplaces. They said they were meant as a “carrot” to entice states to embrace this part of the law. They cited a section of the law that said the subsidies would be available to those “enrolled through an Exchange established by the State.”

Lower courts have sided with the government, which contended that Congress meant for the subsidies to be available in all states, including those that left the job of setting up a marketplace to the federal government. It said the intent was obvious from the law’s context, which is why the Internal Revenue Service wrote rules clarifying that the subsidies would be available everywhere.

In the 2-to-1 opinion Tuesday in the D.C. case, Circuit Judge Thomas B. Griffith wrote that this interpretation is incorrect. Although the federal government may establish an exchange on behalf of a state, he wrote, “it does not in fact stand in the state’s shoes when doing so.”

But in the Richmond case, King v. Burwell, which was decided unanimously by that three-judge panel, 4th Circuit Judge Roger L. Gregory wrote that it is not specified as to whether the subsidies should be available in states that declined to set up marketplaces.

Because of this ambiguity, the court concluded that the IRS acted appropriately, and that it is “clear that widely available tax credits are essential to fulfilling the Act’s primary goals and that Congress was aware of their importance when drafting the bill,” Gregory wrote.

The D.C. Circuit panel was made up of two judges appointed by a Republican and one by a Democrat. The 4th Circuit panel consisted of two judges appointed by a Democrat and one — Gregory — who was nominated by President Bill Clinton and renominated by President George W. Bush.

Supporters of the health-care law predicted that these legal challenges will not succeed.

“Today’s decision represents the high-water mark for Affordable Care Act opponents, but the water will recede very quickly,” Ron Pollack, executive director of the consumer health organization Families USA, said in a statement.

Republicans, however, cited the decision as more evidence that the legislation is flawed.

“Today’s decision rightly holds the Obama administration accountable to the law. The plain text of Obamacare authorizes subsidies only through state exchanges, not the federal exchange,” said Sen. Orrin G. Hatch (Utah), the ranking Republican on the Senate Finance Committee. “The court considered the administration’s justifications and came to an unmistakable conclusion: President Obama overreached.”

If the D.C. decision is upheld, it will have wide-ranging consequences for states that declined to set up their own marketplaces.

The ruling would affect 27 states, most with Republican leaders who oppose the health-care law, and nine states that partly opted out of setting up marketplaces. Those states are instead being served by the federal marketplace, HealthCare.gov.

Legal experts said that under the D.C. ruling, companies in those states would no longer be penalized for not offering their workers health insurance under the employer mandate, which will take effect next year. This is because under the law, employer penalties for not providing health coverage are triggered only when a worker receives a subsidy.

Lack of subsidies also would put insurance financially out of reach for the millions of people who are relying on the help this year to pay their premiums. That, in turn, would weaken the law’s requirement that most Americans carry health coverage by increasing the number who qualified for a hardship exemption based on insurance prices.

About 9 in 10 people in states relying on the federal marketplace bought health plans with the help of the subsidies. The average tax credit for a person this year is $276, lowering the person’s premium from an average price of $345 per month to an average of $69, federal figures show.

If the D.C. Circuit grants the administration’s request for a full “en banc” hearing, legal experts say, the law’s supporters will be more likely to prevail. The court has four relatively new judges nominated by Obama, and the partisan split on the court is now 7 to 4 in favor of those appointed by Democratic presidents.

If the full court overturns the panel decision, there will be no split among the circuits.

The losers in the 4th Circuit Court’s decision have the same option to ask for a review of the full court. But that court also is now dominated by judges nominated by Democrats, and the challengers may think their chances are better at the Supreme Court and take their appeal there.

The question the courts address — how to handle insurance subsidies in the three dozen states relying on the federal marketplace — was one that neither Democrats nor Republicans had anticipated when the Affordable Care Act was written. Even though the measure squeaked through Congress without GOP support, lawmakers and health policy specialists anticipated that virtually all states would create their own insurance exchanges. Exchanges were designed to make coverage more accessible to the minority of Americans who cannot obtain an affordable health plan through a job.

The law offered states money to set up marketplaces. And the thinking was that even states with Republican leaders would be eager to run their own marketplaces in the name of state autonomy. So it was a surprise that Republican antipathy to the law proved so intense that three dozen states balked at setting up exchanges, making the federal marketplaces — intended as a lightly used fallback — the main source of new health plans in the country when the exchanges opened for enrollment in October.

Robert Barnes and Ann Marimow contributed to this report.