The Supreme Court, in a landmark ruling Thursday, upheld President Obama's health care overhaul, including the controversial requirement that most Americans have health insurance.
The court handed Obama a campaign-season victory in rejecting arguments that Congress went too far in requiring Americans to have health insurance or pay a penalty.
Chief Justice John Roberts announced the court's judgment that allows the law to go forward with its aim of covering more than 30 million uninsured Americans.
- Click here to read court's decision
The court, however, found problems with the law's expansion of Medicaid, but even there said the expansion could proceed as long as the federal government does not threaten to withhold states' entire Medicaid allotment if they don't take part in the law's extension.
The court's four liberal justices, Stephen Breyer, Ruth Bader Ginsburg, Elena Kagan and Sonia Sotomayor, joined Roberts in the outcome. Justices Samuel Alito, Anthony Kennedy, Antonin Scalia and Clarence Thomas dissented.
Stocks of hospital companies moved sharply higher on the decision, including HCA Holdings , Community Health Systems and Tenet Healthcare .
Medicaid-related stocks such as Amerigroup and Molina also jumped.
Stocks of drug companies and medical device makers were slightly lower, as were the biggest insurance companies.
- See How All Health Care Stocks Did
"This gives us clarity, which is what markets needed," said Todd Schoenberger, Managing Principal at the Blackbay Group in New York. "This resolved the uncertainty about health care."
"However," he added, "with that said, there seems to be some confusion on the ruling. I'm getting word that the mandate is looking like a tax, and if that is the case, that could hurt the economy and that won't help at all. Who knows how this impacts the election?"
The markets overallwere sharply lower amid skepticism that European leaders would be able to form a solution to tackle the ongoing debt crisis.
"The Affordable Care Act's requirement that certain individuals pay a financial penalty for not obtaining health insurance may reasonably be characterized as a tax," Chief Justice Roberts wrote for the court's majority in the opinion.
"Because the Constitution permits such a tax, it is not our role to forbid it, or to pass upon its wisdom or fairness," he concluded.
In another part of the decision and in a blow to the White House, a different majority on the court struck down the provision of the law that requires the states to dramatically expand the Medicaid health insurance program for the poor.
The upholding of the insurance purchase requirement, known as the "individual mandate," was a major election-year victory for Obama, a historic ruling on the law that aimed to extend coverage to more than 30 million uninsured Americans.
The 2010 law constituted the $2.6 trillion U.S. healthcare system's biggest overhaul in nearly 50 years. Critics of the law had said it meddles too much in the lives of individuals and in the business of the states.
Twenty-six of the 50 U.S. states and a small business trade group challenged the law in court. The Supreme Court in March heard three days of historic arguments over the law's fate.
The court's ruling on the law could figure prominently in the run-up to the Nov. 6 election in which Obama seeks a second four-year term against Republican challenger Mitt Romney, who opposed the law.
The ruling produced a day of drama at the Supreme Court, as the justices read various parts of the opinions from the bench on the last day of the court's term.
Roberts concluded his 59-page opinion by writing: "The Framers (of the U.S. Constitution) created a federal government of limited powers and assigned to this court the duty of enforcing those limits," he wrote.
"The court does so today. But the court does not express any opinion on the wisdom of the Affordable Care Act. Under the Constitution, that judgment is reserved to the people," he said.
The healthcare case produced four different opinions, totaling 187 pages.
U.S. House of Representatives Speaker John Boehner, the top Republican in Congress, renewed his vow to try to repeal the healthcare law.
"Today's ruling underscores the urgency of repealing this harmful law in its entirety," Boehner said in a statement just minutes after the court released its ruling.
Boehner's Republican-led House will likely vote to repeal the measure, but Obama's fellow Democrats in the Senate are certain to block it.
Obama and his fellow Democrats expended a great deal of energy and political capital in securing congressional passage of the measure over unified Republican opposition. The law is reviled by conservatives, who dubbed it "Obamacare."
The healthcare battle has been the most politically charged case before the Supreme Court since 2000, when the justices halted the Florida vote recount in a ruling that gave the Republican Bush the presidency over Democrat Al Gore.
Unlike healthcare in other rich countries, the U.S. system is a patchwork of private insurance and restrictive government programs that has left tens of millions of people uninsured.
The United States pays more on healthcare than any other country.