The Supreme Court rejected the latest major Republican-led effort to kill the national health care law known as “Obamacare” on Thursday, preserving insurance coverage for millions of Americans.

The justices, by a 7-2 vote, left the entire Affordable Care Act intact in ruling that Texas, other GOP-led states and two individuals had no right to bring their lawsuit in federal court.

The law’s major provisions include protections for people with existing health conditions, a range of no-cost preventive services, expansion of the Medicaid program that insures lower-income people and access to health insurance markets offering subsidized plans.

“The Affordable Care Act remains the law of the land,” President Joe Biden, said, celebrating the ruling. He called for building further on the law that was enacted in 2010 when he was vice-president.

And with a Supreme Court that includes three appointees of former President Donald Trump, opponents of “Obamacare” hoped a majority of the justices would finally kill the law they have been fighting for more than a decade.

But the third major attack on the law at the Supreme Court ended the way the first two did, with a majority of the court rebuffing efforts to gut the law or get rid of it altogether.

Trump’s appointees – Justices Amy Coney Barrett, Neil Gorsuch and Brett Kavanaugh – split their votes. Kavanaugh and Barrett joined the majority. Gorsuch was in dissent, signing on to an opinion from Justice Samuel Alito.

Justice Stephen Breyer wrote for the court that the states and people who filed a federal lawsuit “have failed to show that they have standing to attack as unconstitutional the Act’s minimum essential coverage provision.”

In dissent, Alito wrote, “Today’s decision is the third installment in our epic Affordable Care Act trilogy, and it follows the same pattern as installments one and two. In all three episodes, with the Affordable Care Act facing a serious threat, the Court has pulled off an improbable rescue.” Alito was a dissenter in the two earlier cases in 2012 and 2015, as well.

Like Alito, Justice Clarence Thomas was in dissent in the two earlier cases, but he joined Thursday’s majority, writing, “Although this Court has erred twice before in cases involving the Affordable Care Act, it does not err today.”

With the latest ruling, the Supreme Court reaffirmed that “the Affordable Care Act is here to stay,” former President Barack Obama said, adding his support to Biden’s call to expand the law.

Texas Attorney General Ken Paxton pledged to continue the fight against “Obamacare,” which he called a “massive government takeover of health care.”

Chief Justice John Roberts said during arguments in November that it seemed the law’s foes were asking the court to do work best left to the political branches of government.

The court’s decision preserves benefits that have become part of the fabric of the nation’s health care system.

Polls show that the law has grown in popularity as it has endured the heaviest assault. In December 2016, just before Obama left office and Trump swept in calling the ACA a “disaster,” 46 per cent of Americans had an unfavorable view of the law, while 43 per cent approved, according to the Kaiser Family Foundation tracking poll. Those ratings flipped, and by February of this year 54 per cent had a favorable view, while disapproval had fallen to 39 per cent in the same ongoing poll.