By Agence France-Presse
US District Judge Reed O'Connor's 55-page ruling came in a lawsuit filed by several Republican state attorneys general opposed to the federal government health plan, known officially as the Affordable Care Act.
Conservative Republicans have long opposed the plan, signed into law by president Barack Obama in 2010.
The case is likely to reach the US Supreme Court, where the five justices in the nine-judge court who voted to uphold Obamacare in a separate case in 2012 are still on the bench.
O'Connor's ruling said that the full Obamacare program was unconstitutional because in last year's tax overhaul, Congress eliminated a penalty for people who failed to sign up for the program if they did not already have their own health insurance.
The 2012 Supreme Court case was over whether such a penalty was legal -- but now that it is gone, O'Connor says the whole Affordable Care Act should be stricken down because the provision is "the keystone" of the program.
President Donald Trump, who has long criticized Obamacare and vowed to repeal the probram, lost no time in tweeting his opinion.
"Wow, but not surprisingly, ObamaCare was just ruled UNCONSTITUTIONAL by a highly respected judge in Texas. Great news for America!" Trump wrote.
"As I predicted all along, Obamacare has been struck down as an UNCONSTITUTIONAL disaster!" he said.
Trump urged Republican Senate Majority Leader Mitch McConnell and likely incoming Democratic Speaker of the House Nancy Pelosi and to "pass a STRONG law that provides GREAT healthcare."
Angry Democrats blamed Republicans for what they see as a debacle that will leave millions of Americans without healthcare and vowed to fight back in court.
The ruling "exposes the monstrous endgame of Republicans' all-out assault on people with pre-existing conditions and Americans' access to affordable health care," Pelosi said in a statement.
While the court's "absurd ruling will be immediately appealed, Republicans are fully responsible for this cruel decision," she said.
For Democratic Senate Minority Leader Chuck Schumer, the ruling "seems to be based on faulty legal reasoning and hopefully it will be overturned."
However if this "awful ruling is upheld in the higher courts, it will be a disaster for tens of millions of American families," he said.
Opposing the lawsuit are 17 Democratic attorneys general led by Xavier Becerra of California.
They argue that the tax law changes do not mean that the whole Affordable Care Act becomes unconstitutional.
The ruling "is an assault on 133 million Americans with pre-existing conditions, on the 20 million Americans who rely on the A.C.A.'s consumer protections for health care, on America's faithful progress toward affordable health care for all Americans," Becerra said in a statement.
"Our fight to save Obamacare is far from over. We will continue to fight these efforts to take Americans' healthcare away," he tweeted.
The ruling came one day before the Saturday deadline to sign up for ACA coverage in 2019.
The White House said in a statement it expects the case to be appealed to the Supreme Court. "Pending the appeal process, the law remains in place," the statement said.