A US federal judge in Texas has ruled the Affordable Care Act – also known as “Obamacare” – is unconstitutional.

In a 55-page opinion, US District Judge Reed O’Connor ruled that last year’s tax cut bill knocked the constitutional foundation from under “Obamacare” by eliminating a penalty for not having coverage.

The rest of the law cannot be separated from that provision and is therefore invalid, he wrote.

Supporters of the law immediately said they would appeal.

“Today’s misguided ruling will not deter us: our coalition will continue to fight in court for the health and wellbeing of all Americans,” said California Attorney General Xavier Becerra, who is leading a coalition of states defending the Affordable Care Act (ACA).

The White House applauded Mr O’Connor’s ruling, but said the law remains in place while appeals proceed.

President Donald Trump tweeted that Congress should pass a new law.

“As I predicted all along, Obamacare has been struck down as an UNCONSTITUTIONAL disaster!” Mr Trump tweeted.

“Now Congress must pass a STRONG law that provides GREAT healthcare and protects pre-existing conditions.”

However, Congress is unlikely to act while the case remains in the courts.

Numerous high-ranking Republican politicians have said they did not intend to also strike down popular provisions such as protection for people with pre-existing medical conditions when they repealed the ACA’s fines for people who can afford coverage but remain uninsured.

Still, Democratic Representative Nancy Pelosi, who is expected to become House speaker in January, vowed to fight what she called an “absurd ruling”.

She said the House “will move swiftly to formally intervene in the appeals process to uphold the life-saving protections for people with pre-existing conditions and reject Republicans’ effort to destroy the Affordable Care Act”.

Health Overhaul-LawsuitThe federal judge in Texas ruled the Affordable Care Act “invalid” (Alan Diaz/AP)

White House press secretary Sarah Huckabee Sanders said: “We expect this ruling will be appealed to the Supreme Court. Pending the appeal process, the law remains in place.”

Legal expert Timothy Jost, a supporter of the health law, said Mr O’Connor’s ruling would have repercussions for nearly all Americans if it stands.

If the entire health law is invalidated, popular provisions that benefit Medicare beneficiaries and people with employer coverage would also be scrapped. That could include the section that allows parents to keep young adult children on their coverage until age 26.

About 20 million people have gained health insurance coverage since the ACA passed in 2010 without a single Republican vote.

Currently, about 10 million have subsidised private insurance through the health law’s insurance markets, while an estimated 12 million low-income people are covered through its Medicaid expansion.

Saturday is the sign-up deadline for 2019 private plans. Meanwhile, a number of states are expected to move forward with Medicaid expansion after Democratic victories in the midterm elections.

If the case were to reach the Supreme Court it would mark the third time the justices consider a challenge to fundamental provisions of the law.

“Obamacare” opponents lost both the first two cases.

The five justices who upheld the health law in 2012 in the first major case — Chief Justice John Roberts and the court’s four liberals — are all still serving.