The Supreme Court ruled 7-2 on Thursday against Texas and other Republican-led states seeking to strike down Obamacare in the law’s latest test before the nation’s highest court.

The court reversed an appeals court ruling that had struck down the law’s individual mandate provision. Chief Justice John Roberts and fellow conservative Justices Clarence Thomas, Brett Kavanaugh and Amy Coney Barrett joined Justice Stephen Breyer’s opinion, as did Sonia Sotomayor and Elena Kagan.

The decision is a major victory for the legislation, which former President Barack Obama signed in 2010. The law has since become a crucial element of the nation’s health-care system, responsible for the coverage of tens of millions of Americans.

President Joe Biden, who served as Obama’s vice president when the law was signed, praised Thursday’s ruling as a “major victory” for millions of Americans who were at risk of losing their health care in the midst of the Covid pandemic if the law was overturned.

Biden vowed to expand Obamacare, a central promise of his presidential campaign.

The decision marks the third time that Obamacare, officially known as the Affordable Care Act, has survived a challenge before the Supreme Court. Defenders of the law worried that the panel, which now has a 6-3 majority of Republican-appointed justices, would scrap the legislation, which has long been criticized by conservatives.