Wall Street is less worried about the worst-case scenario for insurers: that the court strikes down the individual mandate requiring people buy insurance, but keeps in place provisions that could force insurers to cover more sick, high-cost Americans.

Investors also increasingly believe the whole law may be tossed out, analysts said, which could boost health insurer stocks in the near term. Several analysts pointed to UnitedHealth Group as a stock that should do well regardless of the ruling, while Aetna Inc has been a strong performer this week.

The high court heard three days of arguments over the law championed by President Barack Obama this week, with close scrutiny paid to every question posed by its justices.

Legal and political commentators saw shared support for the law among the court's four liberal appointees, but question whether Obama's administration will win over one of five conservative justices needed to keep the law intact.

As the nation waits for a ruling in late June, the thesis for healthcare investors has changed slightly, analysts and fund managers say.

In the worst-case scenario, the court strikes down the individual mandate, which requires people buy insurance or face a penalty, while maintaining provisions that force insurers to offer coverage regardless of health status.

Insurers have said that the mandate is necessary to ensure that healthy people are in the insurance pool, because without it they would only see an influx of sick, high-cost consumers.

But given the court's debate, analysts said, investors are discounting chances of such a partial decision.

"Investors gained comfort with the operating environment that (health insurers) are going to have," Jefferies & Co analyst David Windley said. "The worst case is now unlikely."

Analysts cautioned that health insurer stocks could tumble 5 percent or perhaps much more if the individual mandate alone is struck down.

"People at this point have pretty much dismissed the potential for an adverse outcome here, which would be the individual mandate gets tossed and everything else remains the same," Susquehanna Financial Group analyst Chris Rigg said.

Shares of large health insurers outperformed the market this week, and posted significant gains on Thursday.

Aetna jumped 6.5 percent on Thursday, while Coventry Health Care rose 5.9 percent and UnitedHealth and Cigna Corp both climbed more than 4 percent.

For the week, the Morgan Stanley Healthcare Payor index of insurers rose about 6 percent through Thursday against roughly flat performance for the broader S&P 500 index.

THESIS CHANGING

Going into the start of the debate on Monday, the consensus among investors was that the law will be upheld -- a decision viewed as modestly positive for insurer stocks because it would create more certainty about their business in the coming years.

But the high court's debate created the impression among many on Wall Street that there is a greater chance the mandate is at risk, and possibly the entire law.

For example, former Aetna Chief Executive Ron Williams told CNBC television on Thursday he now believed that the individual mandate, had a "high probability" of being overturned.

"Going into the debate on the mandate, there was almost a sense of complacency out there that the mandate would stand, as would the law," CRT Capital analyst Sheryl Skolnick said. "Investors were thrown a curve ball."

However, should the mandate be struck down, the most likely scenario is that the court will also strike down provisions that require insurers enroll all individuals regardless of health status, according to Sanford Bernstein analyst Ana Gupte.

This scenario is positive for insurers because it eliminates risks from enrolling potentially unprofitable members through the new insurance exchanges to be created by the law, but would still allow the companies to increase their membership through the expansion of the Medicaid health program for low-income Americans.

Gupte called the court's developments this week "thesis-changing" for investors given that the diminished chance of the worst-case decision and the improved odds for the more positive scenario.

Thursday's rise for insurer stocks indicated that investors also may have been pricing in the court overturning the entire law, according to analysts at Goldman Sachs.

Such a ruling would also create uncertainty for the insurers, but could help their stocks in the near term by eliminating new regulations viewed as onerous to the industry.

OVERTURN NEGATIVE FOR HOSPITALS, MEDICAID COS

Wall Street generally agrees that an overturn would hurt hospital companies. The law stands to increase the potential pool of paying patients by providing coverage for more than 30 million uninsured, many of whom otherwise might seek care but leave hospitals with unpaid bills.

Hospitals shares have traded lower during the week. Through Thursday, HCA Holdings fell 4.6 percent, Tenet Healthcare declined 1.7 percent and Community Health Systems slipped 0.9 percent.

"They could experience some additional weakness," CRT's Skolnick said. "I can't see where first-quarter earnings are going to generate a rally. I think they're going to be range-bound."

At the same time, Skolnick said, "Should reform pass this test completely, you wouldn't want to be short the hospitals."

Shares of insurers that specialize in Medicaid also may come under pressure ahead of the decision. The law is set to significantly expand Medicaid, providing a new growth opportunity for these smaller insurers.

Although the consensus seemed to be that the court would uphold the specific portion dealing with the Medicaid expansion, an overturn of the entire law could negate the expansion.

For now, investors do not seem overly concerned about this possibility: Shares of Medicaid specialists Amerigroup and Molina Healthcare both rose 1.7 percent for the week through Thursday, while Centene climbed 5.7 percent.

Oppenheimer & Co analyst Michael Wiederhorn said to expect some volatility among such companies until June, but said he'd "use weakness in the Medicaid names as a buying opportunity."

"When you look at the big picture of the Medicaid names, states are still struggling," Wiederhorn said. "States will continue to outsource this business."

Even as investors placed bets, some analysts maintained that nothing definite emerged from the three-day proceedings.

"It's a fool's game to try to figure out a 5-4 vote one way or another," Wiederhorn said.

(Reporting By Lewis Krauskopf; Editing by Michele Gershberg and Derek Caney)

By Lewis Krauskopf