In a ruling that was quickly dubbed as "insane" by critics, a federal judge in Texas ruled that the entirety of the Affordable Care Act — also known as "Obamacare" — was unconstitutional.

It appears the law will still technically be in place while the case goes through appeals, however.

Judge Reed O'Connor had been expected to rule against the law, brought by Republican states attorneys general, but the scope of his ruling Friday night still shocked many observers. The lawsuit he heard targeted the law's individual mandate, which sets a tax penalty for every who American who doesn't sign up for health insurance.

The mandate had already been upheld by the Supreme Court, so it would have seemed that the lawsuit was pointless. It seems even more pointless because last year the Republicans voted to set the cost of the individual mandate to zero, effectively nullifying it.

But its petitioners made a novel — and to most credible legal experts, bogus — argument that because the mandate's fine was $0, it was no longer a tax, and it was thus unconstitutional.

Confused? You should be, because even legal scholars argued it makes no sense. And it gets even worse.

The petitioners, and now Judge O'Connor, argued that because the provision was seen as a key part of the law when it was passed by Congress in 2010, the whole law must be thrown out with the mandate struck down. However, this completely misses the fact that the Congress in 2017 specifically voted on changes to the law, decided not to repeal it in its entirety, and chose only to reset the mandate's penalty to zero.

"Distro court judge strikes down ACA, mangling multiple legal doctrines in the process," wrote Jonathan Adler, a conservative legal analyst. "I doubt this opinion will survive appeal."

Adler also agreed with law professor Nicholas Bagley, who called the ruling "insane."

"Congress eliminated the penalty and left the rest of the ACA in place. It really is that simple," said Adler.