Opponents of President Obama’s health care law notched their biggest legal win to date Tuesday, when the second-most-powerful court in the country said the administration had unlawfully extended Obamacare subsidies to millions of Americans.

But their victory party was short-lived, as hours later another federal appeals court sided with the Obama administration on the subsidy question, almost certainly setting up an extended legal battle that could reach the Supreme Court.

A final loss for the White House would strip premium assistance from dozens of states and blow a massive hole in President Obama’s signature health overhaul, which Democratic majorities muscled through Congress in 2010 with no Republican support.

“Today’s conflicting court rulings highlight the flaws and ambiguity of Obamacare,” said Sen. Rob Portman, Ohio Republican. “This is the predictable result of forcing a partisan piece of legislation through Congress without amendment, proper consideration or bipartisan input.”

The Court of Appeals for the D.C. Circuit held that people living in states that relied on the federal government to set up their insurance market exchanges cannot receive the subsidies considered critical to making coverage affordable.

The panel’s 2-1 decision invalidated an IRS rule that, plaintiffs in Halbig v. Burwell had argued, stretched the meaning of the Affordable Care Act, which said financial aid to low- and middle-income people should flow to exchanges “established by the State.”

If that means only exchanges established by the state, it cuts off subsidies to about two-thirds of the nation. In 2011, the IRS issued a regulation declaring that residents of all states were eligible for subsidies regardless of whether the state established exchanges. Critics of Obamacare called that a lawless attempt to cover up a flaw in the law as written.

“We reach this conclusion, frankly, with reluctance,” Judge Thomas B. Griffith said in his opinion for the court. “At least until states that wish to can set up Exchanges, our ruling will likely have significant consequences both for the millions of individuals receiving tax credits through federal Exchanges and for health insurance markets more broadly.”

Hours later, the 4th U.S. Circuit Court of Appeals said subsidies may flow to all states, creating a split in the federal appellate courts. The judges in Richmond reasoned that Obamacare’s language was ambiguous and that the IRS rule was “a permissible exercise of the agency’s discretion.”

The Obama administration said it plans to appeal the D.C. Circuit’s decision because the subsidies are a huge draw for Obamacare customers. Without that selling point, the reforms would effectively collapse under the weight of premiums that are no longer affordable.

The White House likely will ask the entire D.C. panel to hear the case as the makeup of the court leans in Democrats’ favor. The losers in the 4th Circuit may make a similar request.

Some legal analysts said the decisions to date have been swayed by judges’ political designations, a key factor if the issue reaches the Supreme Court.

“Given the 5-4 partisan split on the Supreme Court, this does not bode well for the ACA,” said David Bernstein, a professor at George Mason University School of Law.

White House press secretary Josh Earnest said the D.C. ruling will not affect consumers’ ability to receive tax credits right now.

“While this ruling is interesting to legal theorists, it has no practical impact,” he said.