Washington (CNN) The Affordable Care Act that Congress passed in 2010 was decades in the making, an effort to control rising health care costs and provide insurance to millions of Americans. The US Supreme Court twice upheld it, emphasizing that history, and the law survived countless attempts by Republicans to repeal it.

Last year, when the Republican Congress lifted an ACA tax penalty -- tied to the individual insurance requirement -- it left other coverage intact.

But in his startling Friday night ruling , US District Court Judge Reed O'Connor in Texas sized up Congress' intentions and declared that because of the tax change, the entire law must fall -- erasing the individual coverage mandate, along with expanded Medicaid, and insurance protections for people with cancer, diabetes and other pre-existing health conditions.

O'Connor's 55-page ruling, currently on hold and subject to appeal, was immediately disparaged by critics on the left and on the right and by law professors on both sides of the dispute. He selectively cited congressional history and Supreme Court justices to reach his result.

Yet prior litigation over the law dubbed Obamacare suggests seemingly far-fetched arguments can go far and roil the courts. O'Connor's decision may be reversed on an intermediate appeal, but because of the importance of the massive law, a looming question reverberated Monday: What would the Supreme Court do?

In earlier cases, the court upheld the law by one vote, in 2012, and by two votes, in 2015. And all five justices who upheld Obamacare in 2012 -- the four liberal justices and Chief Justice John Roberts -- remain on the bench.

"Congress passed the Affordable Care Act to improve health insurance markets, not to destroy them," Roberts wrote in the 2015 case, after noting the ambiguity of a provision that challengers argued would invalidate the law. "If at all possible, we must interpret the Act in a way that is consistent with the former, and avoids the latter."

Trump on Monday tweeted that he hoped the Supreme Court would uphold the Texas ruling and end Obamacare. "A confirming Supreme Court Decision will lead to GREAT HealthCare results for Americans!" he wrote.

The DEDUCTIBLE which comes with ObamaCare is so high that it is practically not even useable! Hurts families badly. We have a chance, working with the Democrats, to deliver great HealthCare! A confirming Supreme Court Decision will lead to GREAT HealthCare results for Americans! — Donald J. Trump (@realDonaldTrump) December 17, 2018

The President's many tweets focused on the judiciary signal a belief that his appointees would side with him. But that might not even be true with newest justice, Brett Kavanaugh. As an appeals court judge in Washington, DC, Kavanaugh declined to rule against the law as he sidestepped the merits of a dispute on procedural grounds.

Trump v Roberts

Roberts has also recently demonstrated a greater interest in shielding the high court from Washington's partisanship, most visibly in his November rebuke of Trump for labeling a jurist an "Obama judge."

"We do not have Obama judges or Trump judges, Bush judges or Clinton judges," Roberts wrote in a statement. "What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them."

And Trump knows that a Roberts vote against Obamacare is no sure thing.

While he was a presidential candidate, Trump in 2016 called Roberts a "nightmare for conservatives" in an interview on ABC . "Justice Roberts could've killed Obamacare and should've, based on everything -- should've killed it twice," Trump said.

And in 2012, Trump tweeted : "Congratulations to John Roberts for making Americans hate the Supreme Court because of his BS."

Still, a new Supreme Court test is not imminent.

Because of the normal progression of appeals, the justices are unlikely to rule on the current case before 2020. The justices are about a month short of setting their full 2018-19 argument calendar.

How the court previously upheld Obamacare

On March 23, 2010, when President Barack Obama signed the Affordable Care Act, several Republican- led states were ready to launch a lawsuit challenging the centerpiece requirement of the law that forces all Americans to buy health insurance. By a 5-4 vote in 2012, the justices upheld that provision.

The high court -- in a hard fought, divisive opinion written by Roberts -- rejected the Obama administration's justifications based on Congress' power to regulate interstate activity but rather said that the individual mandate could be upheld on the taxing power. The law included a penalty (for those who refused to buy insurance) to be collected by the Internal Revenue Service with annual tax filings.

Roberts was joined in that opinion by the court's four liberal justices, although they would have upheld the law on Congress' commerce power. The four dissenting justices, all conservatives, rejected all legal grounds.

A separate, narrower challenge in 2015 came down to a 6-3 vote, with then-Justice Anthony Kennedy, who had dissented in 2012, joining the majority view upholding the challenged portion of the law. Kavanaugh succeeded Kennedy in October.

The current dispute, brought by Texas and 19 other Republican-led states, tests whether Congress' 2017 removal of the tax means the individual mandate cannot be enforced. (That new insurance requirement flowed from Congress' goal of universal coverage and the notion that as more people bought insurance the overall cost of premiums would be lower.)

The state challengers also boldly declared that if the insurance requirement fell, the entire law was doomed.

Ruling on the eve of the 2019 insurance enrollment deadline, O'Connor agreed. He discarded the traditional court principle that judges should respect portions of legislation not deemed unconstitutional.

To justify his decision striking down everything, he pointed to lines in the 2010 law describing the individual mandate as "essential" and to statements of Supreme Court justices emphasizing the importance of the mandate to the entire law.

But in both situations, Congress and the justices were, in a practical vein, speaking more to the workability of the law, not the overall legal validity, and focused only on 2010, not the 2017 tax revision.

O'Connor, a 2007 appointee of President George W. Bush, stated at the outset of his opinion that he was not tasked with "policymaking." Yet his approach deemed irrelevant that when Congress removed the tax penalty in 2017, it did not change the individual mandate and did not amend the rest of the Affordable Care Act.

Not even the Trump administration had argued that the entire law should be thrown out, though it sided with the states against the individual mandate.

If justices follow their precedent, it is likely that most, if not all, of Obama's signature domestic achievement would endure.