Image copyright Getty Images

A federal judge in the US state of Texas has ruled that a key part of the Affordable Care Act (ACA), better known as Obamacare, is unconstitutional.

Twenty states argued the whole law was invalidated by a change in tax rules last year which eliminated a penalty for not having health insurance.

President Donald Trump said the ruling was great news for America.

The law's provisions will, however, remain in place until an appeal is heard at the US Supreme Court.

President Trump promised to dismantle Barack Obama's landmark 2010 healthcare law, which was designed to make medical cover affordable for the many Americans who had been priced out of the market.

But despite his Republican Party having majorities in both the House of Representatives and the Senate, the ACA is still operating.

However, in 2017 Congress did repeal the requirement - the so-called individual mandate - that people buy health insurance or pay a tax penalty.

Mr Trump took to Twitter following the judge's ruling in Texas.

He also urged incoming Democratic Senate minority leader Chuck Schumer and Democratic Speaker of the House Nancy Pelosi to "pass a STRONG law that provides GREAT healthcare".

The ruling came a day before the deadline for Obamacare enrolment for the coming year.

What does the ruling say?

Two Republicans - Texas Attorney General Ken Paxton and his Wisconsin counterpart Brad Schimel led the legal challenge.

Sitting in Fort Worth, US District Judge Reed O'Connor noted that a $1.5tn tax bill passed by Congress in 2017 eliminated the tax penalties which anyone who failed to obtain health insurance had to pay.

He ruled that the individual mandate was now unconstitutional.

As the individual mandate was an "essential" element of the ACA, the whole of Obamacare was therefore unconstitutional, Judge O'Connor said.

He said his ruling was concerned with the intentions of the 2010 and 2017 Congresses.

"The former enacted the ACA. The latter sawed off the last leg it stood on."

Image copyright Getty Images Image caption Health care provision in the US has long been a divisive issue

What reaction has there been?

Ms Pelosi described the ruling as "cruel" and "absurd" and said it would be repealed.

She said it exposed "the monstrous endgame of Republicans' all-out assault on people with pre-existing conditions and Americans' access to affordable health care".

Mr Schumer, meanwhile, said the ruling appeared "to be based on faulty legal reasoning and hopefully it will be overturned".

He said that if it was upheld in the higher courts "it will be a disaster for tens of millions of American families, especially for people with pre-existing conditions".

What comes next?

The decision is almost certain to be challenged in the US Supreme Court.

White House spokeswoman Sarah Sanders said that the law would remain in place for the time being, pending further legal developments.

Media playback is unsupported on your device Media caption 'Trump not thinking about the little people'

Meanwhile, the White House called on Congress to replace Obamacare with an affordable healthcare system which protects people with pre-existing conditions.

But other states have argued that eliminating Obamacare would harm millions of Americans, and pending any appeal the landmark health care law remains in place.

US Senate Democratic leader Chuck Schumer said: "If this awful ruling is upheld in the higher courts, it will be a disaster for tens of millions of American families."