Barack Obama’s legacy as the president who reshaped the U.S. health-care system withstood its biggest challenge since 2012 when the Supreme Court ended any immediate threat that millions might lose medical coverage.

The decision touches every part of health care in the U.S. Hospitals, whose stocks rose after the ruling, needn’t fear suddenly uninsured masses at their doors. Insurers are promised billions in subsidies for customers’ coverage. More than 6 million Americans who rely on discounted premiums needn’t worry that their plans will become unaffordable.

Celia Maluf, a 60-year-old Pilates instructor in Miami who had been uninsured for years before the Affordable Care Act, said she broke into tears at the news. “I feel like I won the Lotto,” she said.

For Obama, the 6-3 decision that subsidies should be available nationwide meant his eponymous law passed in 2010 would likely endure for the remainder of his presidency. Republicans are left to try to succeed him after eight years in 2016, and then muster the will to gut a program on which as many as 36 million Americans depend.

“The Affordable Care Act is here to stay,” Obama said in the White House Rose Garden.

Undoing Obamacare

The decision strikes at a tenet of the modern-day Republican party: Obamacare must be undone. Many Republicans in Congress and running to succeed Obama vowed to continue the fight. The most concrete plan to repeal the law is a complex legislative maneuver that would face Obama’s veto.

“The Supreme Court abandoned the Constitution to resuscitate a failing health-care law,” Texas Governor Greg Abbott, a Republican, said in a statement. “Today’s action underscores why it is now more important than ever to ensure we elect a president who will repeal Obamacare.”

Texas, where about 20 percent of citizens lacked insurance in 2013, would have been one of the states most affected by the law’s end. About 966,000 Texans had signed up and paid for Affordable Care Act plans as of March, and 86 percent benefit from tax credits that discount their premiums, according to the U.S. Health and Human Services Department.

“We can breathe a sigh of relief,” said Stacey Pogue, a senior policy analyst at the Center for Public Policy Priorities in Austin. “This is a huge victory for Texas consumers.”

Jim Morone, a public-policy professor at Brown University in Providence, Rhode Island, said that the president’s legacy will loom large.

“In the history of health care of America, two towering figures now are Lyndon B. Johnson and Barack Obama,” he said. Johnson signed the 1965 law that created Medicare, the program for the elderly and disabled, and Medicaid, for the poor.

The case, King v. Burwell, was brought by plaintiffs who argued that a single phrase -- “an exchange established by the state”––limited subsidies to 16 that authorized their own insurance marketplaces. Thirty-four states instead rely on the federal system.

“Congress passed the Affordable Care Act to improve health insurance markets, not to destroy them,” Chief Justice John Roberts wrote in the court’s majority opinion. “We must interpret the Act in a way that is consistent with the former, and avoids the latter.”

Medicaid Expansion

The decision also frees groups such as Pogue’s to focus on pressuring states to expand Medicaid, the health program for low-income Americans. About 1 million Texans don’t make enough to qualify for the Affordable Care Act tax credit, yet aren’t poor enough to qualify for Medicaid, she said.

Nationwide, about 3.7 million uninsured, low-income people would gain coverage if 21 states expanded Medicaid, according to the Washington-based Center on Budget and Policy Priorities.

“It is time for opponents of health reform to accept that health reform is here to stay,” Robert Greenstein, president of the group that analyzes how fiscal decisions affect the poor, said in a statement.