A federal judge in Texas struck down ObamaCare on Friday, in a stunning opinion that threatens the future insurance coverage of millions of US residents and will likely be battled over in the Supreme Court.

US District Judge Reed O’Connor found the Affordable Care Act was “invalid” in a decision that came a day before the end of the program’s annual six-week enrollment period.

Any changes to the ACA will be put on hold, however, until appeals are exhausted, the White House said.

President Trump greeted the news with a pair of celebratory tweets.

He called the 55-page opinion “Great news for America!”

“As I predicted all along, ObamaCare has been struck down as an UNCONSTITUTIONAL disaster!” he tweeted.

“Now Congress must pass a STRONG law that provides GREAT health care and protects pre-existing conditions,” he added.

He then urged Senate Majority leader Mitch McConnell and incoming House Leader Nancy Pelosi, “Mitch and Nancy, get it done!”

Judge O’Connor’s opinion focuses on the 2010 ACA’s “individual mandate ” — a provision that had set a tax penalty for not having coverage.

The individual mandate was the linchpin of the ACA, and in 2012 it was cited by the Supreme Court in a 5-4 ruling that upheld the act as a constitutionally protected extension of Congress’s taxing power.

But the tax-cut bill passed by Congress last year eliminated the mandate’s tax penalty, O’Connor noted, and therefore its constitutionality, he wrote.

As a result, the ACA in its entirety became unconstitutional, O’Connor wrote.

With further attacks looming, it’s better to just put the act out of its misery, the judge implied.

Otherwise, “It is like watching a slow game of Jenga, each party poking at a different provision to see if the ACA fails,” he wrote.

Texas and 18 other states had sued to end ACA; New York was among the 16 states opposing.

The outcry was swift.

“If this awful ruling is upheld in the higher courts, it will be a disaster for tens of millions of American families, especially for people with pre-existing conditions,” tweeted Senate Minority Leader Chuck Schumer.

New York Attorney General Barbara Underwood vowed in a tweet to “do all we can” to fight the decision.

“The ACA insures millions of Americans who would otherwise suffer,” Gov. Cuomo tweeted. “New York will fight to save our health care especially for those with pre-existing conditions.”