A legal challenge seeking to cripple Obamacare suffered a huge setback Wednesday as it was defeated in federal court.

The U.S. District Court for the District of Columbia ruled against the challengers, who argued that that the text of Obamacare did not allow the law’s premium tax credits to be offered on federal insurance exchanges — that they must only be available through state-based exchanges.

Judge Paul L. Friedman called that argument “unpersuasive,” saying it didn’t pass legal muster and ran counter to the central purpose of the Affordable Care Act.

“Plaintiffs’ proposed construction in this case – that tax credits are available only for those purchasing insurance from state-run Exchanges – runs counter to this central purpose of the ACA: to provide affordable health care to virtually all Americans,” Friedman wrote in a 39-page decision. “Such an interpretation would violate the basic rule of statutory construction that a court must interpret a statute in light of its history and purpose.”

His reasoning? The federal exchanges — which the Obama administration is constructing for 34 states that declined to build their own — “would have no customers, and no purpose” if the challengers’ logic were adopted.

“In other words, even where a state does not actually establish an Exchange, the federal government can create ‘an Exchange established by the State under [42 U.S.C. § 18031]’ on behalf of that state,” Friedman wrote.

The challenge was seen as a longshot from the start given the fact that government agencies generally have broad discretion to interpret ambiguities in the law, and the I.R.S. has ruled that federal Obamacare exchanges may provide subsidies. The other problem was the lack of evidence that the law’s architects sought to limit the premium tax credits in this manner.

“This argument made no sense from the beginning,” said Tim Jost, a professor of health law at Washington and Lee University who supports Obamacare. “Congress clearly did not mean to exclude residents of two thirds of the states from premium tax credits. Judge Friedman had little trouble finding that the statute clearly authorizes premium tax credits to be granted through federal exchanges. He did not even have to defer to the agency’s interpretation of the statue. His reasoning is persuasive, and will be upheld by the appellate court.”

The case is Halbig v. Sebelius.

Judge Friedman – Halbig v. Sebelius Opinion