(Reuters) - Shares of U.S. health insurers, hospitals and healthcare companies fell on Monday in the aftermath of a ruling by a federal judge in Texas that the Affordable Care Act (ACA), commonly called Obamacare, was unconstitutional.

FILE PHOTO: A sign on an insurance store advertises Obamacare in San Ysidro, San Diego, California, U.S., October 26, 2017. REUTERS/Mike Blake

Many legal experts predicted U.S. District Judge Reed O’Connor’s decision on Friday eventually will be reversed on appeal considering that the law has been upheld by the Supreme Court, but the uncertainty created by the ruling drove down healthcare stocks on Monday.

O’Connor agreed with a coalition of Republican officials from 20 states that Obamacare was unconstitutional based on its mandate requiring that Americans obtain medical insurance. The judge refused the states’ request to issue an injunction immediately blocking 2010 law that was championed by Democratic former President Barack Obama from being enforced.

The White House on Friday said the law would remain in effect pending any appeal.

The fall in healthcare stocks pulled the broader S&P 500 managed health care index .SPLRCHMO down 2.5 percent.

Centene Corp CNC.N fell 7.8 percent to $117.5, while Molina Healthcare MOH.N slumped 10.1 percent to $118.4. The companies are among the health insurers with exposure to ACA.

WellCare Health Plans WCG.N and Anthem Inc ANTM.N declined 4.7 percent and 2.1 percent, respectively.

Brokerage BMO Capital Markets said it expects Centene and Molina to be most affected by the ruling, as they have the highest ACA exposure, which the broker measures as an “estimate of the percentage of company revenue and earnings driven by Obamacare exchanges and/or the Medicaid expansion,” referring to the government insurance program for lower-income people.

“While we are disappointed in the recent Northern District of Texas court’s ACA ruling, we recognize that this is a first step in what will be a lengthy appeals process,” Molina Healthcare said.

“Regardless, the ACA will remain in effect for 2019, and we are optimistic that it will remain in effect thereafter.”

The ACA required that all individuals have health insurance or pay a tax and also included payments worth billions of dollars to health insurers to subsidize insurance for low-income Americans. The Republican-led Congress last year eliminated a penalty that the ACA levied on people who opted not to obtain insurance.

Obamacare expanded by millions the number of Americans with medical insurance. Republicans, including President Donald Trump, have long criticized the law, calling it a costly and unneeded government intrusion into Americans’ lives. About 11.8 million people nationwide enrolled in 2018 Obamacare insurance plans.

Republican state officials, led by the attorney general of Texas, filed a lawsuit last year arguing that getting rid of the penalty rendered the mandate unconstitutional. The Trump administration declined to defend the mandate, spurring Democratic officials in 16 states to intervene.

‘WITHSTOOD SCRUTINY’

California Attorney General Xavier Becerra in a statement said the Democrats would appeal Friday’s decision.

“The ACA has already survived more than 70 unsuccessful repeal attempts and withstood scrutiny in the Supreme Court,” he said.

Most legal experts do not believe the Supreme Court would ultimately strike down the entire law, but the uncertainty could pressure stocks in the near term, brokerage Oppenheimer said.

The ruling, if affirmed, would have a draconian impact on the healthcare sector and the overhang alone could trigger widespread selling across the sector, Oppenheimer analyst Michael Wiederhorn said.

Most legal experts, including conservatives who oppose the mandate, believe the portion of O’Connor’s ruling striking down the entire law will be reversed.

Without the penalty that Congress eliminated last year, the ACA’s individual mandate is “largely toothless” and not essential to the remainder of the law, said Ilya Somin, a law professor at George Mason University in Virginia.

The Supreme Court in 2012 ruled that the individual mandate was a valid exercise of Congress’ taxation powers, with the law imposing a monetary penalty on people who did not obtain insurance.

In Friday’s decision, O’Connor said that because Congress lowered the penalty to zero last year, the mandate no longer came with a “tax” and is unconstitutional. But the judge also held that because the ACA is not financially viable without the mandate, the entire law had to be struck down.

Experts said the problem with O’Connor’s ruling is that Congress last year eliminated the penalty without repealing the entire law. That shows lawmakers believed the law could stand without the mandate, said Nicholas Bagley, a professor at University of Michigan Law School.

But some experts noted that when Congress passed the ACA in 2010, lawmakers acknowledged that the requirement that insurers provided coverage for pre-existing medical conditions had to be paired with the mandate in order to work.

Enforcing the remainder of the law without the mandate “creates a death spiral where rates will go out of control,” said Josh Blackman, a professor at South Texas College of Law whose work O’Connor cited in Friday’s ruling.

Other experts have pointed out what they said was a more fundamental problem with O’Connor’s ruling: the states did not have the standing to sue in the first place. Without the financial penalty in place, the mandate does not cause any harm that can form the basis of a lawsuit, Bagley said.