A federal judge in Texas threw a dagger into the Affordable Care Act on Friday, ruling that the entire health care law is unconstitutional because of a recent change in federal tax law.

The opinion by U.S. District Judge Reed O'Connor overturns all of the sprawling law nationwide.

The ruling came on the eve of the deadline for Americans to sign up for coverage in the federal insurance exchange created under the law.

Since the suit was filed in January, many health law specialists have viewed its logic as weak but nevertheless have regarded the case as the greatest looming legal threat to the 2010 law, which has been a GOP whipping post ever since and assailed repeatedly in the courts.

In March, Utah joined other states, including Texas, to sue the federal government under the premise that the healthcare law is unconstitutional.

“Utah was confident this would be the Texas district court’s ruling and agrees with the decision. The logic is clear ­— when Congress eliminated the individual mandate penalty in 2017, it removed the tenuous link on which the Supreme Court relied to deem the ACA constitutional,” Utah Attorney General Sean Reyes said in a statement Friday night. “We expect this decision will be appealed and look forward to a final resolution in the U.S. Supreme Court. If plaintiffs prevail, it should clear a path for the states and Congress to move forward with solutions including coverage for pre-existing conditions and adult children but without unconstitutional mandates. Such solutions will work better for Americans and be consistent with constitutional limits on government power.”

The Supreme Court upheld the law as constitutional in 2012 and 2015, though the first of those opinions struck down the ACA’s provision that was to expand Medicaid nationwide, letting each state choose instead. No matter how O’Connor ruled, legal experts have been forecasting that the Texas case would be appealed and could well place the law again before the high court, giving its conservative newest member, Justice Brett Kavanaugh, a first opportunity to take part.

O'Connor is a conservative judge on the U.S. District Court for the Northern District of Texas. He was appointed by President George W. Bush. O'Connor ruled once before on an issue arising from the ACA, issuing a nationwide injunction two years ago on an Obama administration rule that forbid providers of health care to discriminate based on gender identity.

And in June, the administration took the unusual step of telling the court that it will not defend the ACA against this latest challenge. Typically, the executive branches argues to uphold existing statutes in court cases.

The lawsuit was initiated by Texas's attorney general Ken Paxton, who describes himself as a tea party conservative, with support from 18 GOP counterparts and a governor. The plaintiffs argue that the entire ACA is invalid. They trace their argument to the Supreme Court's 2012 ruling in which Chief Justice John Roberts Jr. wrote for the majority that the penalty the law created for Americans who do not carry health insurance is constitutional because Congress "does have the power to impose a tax on those without health insurance."

As part of a tax overhaul a year ago, congressional Republicans pushed through a change in which that ACA penalty will be eliminated, starting in January. The lawsuit argues that, with the enforcement of the insurance requirement gone, there is no longer a tax, so the law is not constitutional anymore.

"Once the heart of the ACA - the individual mandate - is declared unconstitutional, the remainder of the ACA must also fall," the lawsuit said.

In a court brief and an accompanying letter to congressional leaders, the Justice Department did not go that far. Justice officials contended that, once the insurance mandate's penalty is gone next month, that will invalidate the ACA's consumer protections, such as its ban on charging more or refusing to cover people with preexisting medical conditions. But the administration argued that many other parts of the law could be considered legally distinct and thus can continue.

Just before the brief's deadline, three Justice attorneys involved with the case withdrew from it.

In the letter to Congress, then-attorney general Jeff Sessions said that Justice was taking this position ""with the approval of the president of the United States." President Trump has vowed since his campaign to dismantle the law, a main domestic achievement of his precessor, and the administration has been taking steps on its own to foster alternative insurance that tends to be less expensive because it skirts ACA requirements.

The lawsuit has been opposed by a coalition of 17 Democratic attorneys general, led by California Attorney General Xavier Becerra, a former congressman. The Democrats contend that the Republican tax law will lower the federal penalty for being uninsured to $0, but does not negate the ACA's constitutionality.

During oral arguments in September, O'Connor asked more pointed questions than of the Democratic attorneys general than of the Republicans.

The midterm elections last month have altered the political map in the case. In Wisconsin, an incoming Democratic attorney general, Josh Kaul, campaigned on a promise to withdraw the state from the lawsuit, but Wisconsin’s Republican legislature and outgoing Gov. Scott Walker, R, have tried in a lameduck session to block his ability to do that. In Maine, outgoing Gov. Paul LePage, R, joined the lawsuit, but the state attorney general’s office told the court last month that the governor did not have power to do so on his own.