The US Supreme Court has upheld President Barack Obama's healthcare law in an election-year triumph for him and fellow Democrats and a stinging setback for Republican opponents of the most sweeping overhaul of the unwieldy US healthcare system in about a half century.
In a 5-4 ruling based on the power of Congress to impose taxes, the court preserved the law's "individual mandate" requiring that most Americans obtain health insurance by 2014 or pay a tax.
Opponents of the law had argued the mandate was an overreach by the federal government into the private lives of citizens. The court was deeply divided on this issue, but the majority ruled that Congress' taxing power was more important.
The law's "requirement that certain individuals pay a financial penalty for not obtaining health insurance may reasonably be characterized as a tax," Chief Justice John Roberts wrote for the court's majority.
"Because the Constitution permits such a tax, it is not our role to forbid it, or to pass upon its wisdom or fairness," wrote Roberts, who was joined by the four most liberal members - Justices Ruth Bader Ginsburg, Stephen Breyer, Elena Kagan and Sonia Sotomayor - in upholding the law's key provision.
The four dissenters, all from the court's conservative wing, were Justices Antonin Scalia, Anthony Kennedy, Clarence Thomas and Samuel Alito. They would have struck down the entire law.
Obama said the ruling was a victory for the American people, and promised to implement it and improve upon it going forward.
"The highest court in the land has now spoken. We will continue to implement this law and we'll work together to improve on it where we can," Obama said at the White House.
"What we won't do - what the country can't afford to do - is re-fight the political battles of two years ago or go back to the way things were. With today's announcement, it's time for us to move forward."
In another part of the decision, the court said Congress went too far in a part of the law that requires states to expand the government's Medicaid health insurance program for the poor in order to extend coverage to many uninsured people.
The court said this problem was addressed by precluding the federal government from withdrawing existing Medicaid funds from states that do not comply with the expansion, but that this did not require striking down other parts of the law.
The healthcare law, known formally as the Patient Protection and Affordable Care Act, is the biggest overhaul of the US$2.6 trillion healthcare system since the 1960s. It was signed by Obama in March 2010 and immediately put to the test in the courts by 26 of the 50 states and a trade group for small businesses.
The court's decision largely vindicates a sweeping attempt to fix a system that, while representing nearly 18 percent of the economy, leaves 16 percent of Americans uninsured, a failure that sets the United States apart in the industrialized world.
The US system, unlike other rich countries, is a patchwork of private insurance and restrictive government programs. The United States pays more for healthcare than any other country but tens of millions of people remain with no insurance at all.
The court's ruling could figure prominently in the run-up to the November 6 election. Obama, seeking a second four-year term, is being challenged by Republican Mitt Romney, who had called for scrapping the law and replacing it with other measures even though he championed a similar approach at the state level as Massachusetts governor.
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 US Constitution) created a federal government of limited powers and assigned to this court the duty of enforcing those limits.
"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 Obama overhaul is designed to bring health insurance to more than 30 million previously uninsured Americans and to slow down soaring medical costs.
Romney and other Republicans had hoped the Supreme Court would gut a law they deride as "Obamacare."
Deprived of that, they can now continue pressing the attack on Obama on the campaign trail, but their hopes for a rollback or repeal will hang on legislation, unlikely before the elections, and on the voting public, whose views are muddled.
Romney said after the ruling that the American people must defeat Obama in the election in order to overturn the law.
"This is a time of choice for the American people. If we're going get rid of 'Obamacare' we're going to have to replace President Obama. My mission is to make sure we do exactly that," said Romney, speaking with the US Capitol as a backdrop.
About 56 percent of Americans said they opposed the law in a Reuters/Ipsos poll recently released. When asked about its individual provisions, however, most respondents said they strongly supported them, except for the individual mandate, which was opposed by 61 percent of those surveyed.
Most respondents in the survey favoured banning insurers from denying coverage to people with pre-existing conditions; letting children stay on their parents' insurance plans until age 26; and making companies with more than 50 workers offer insurance to their employees. All are parts of the law.
So are the creation of state-based exchanges to offer health insurance; insurance premium assistance to poor people; and insurance tax credits for those just above the poverty line.
US House of Representatives Speaker John Boehner, immediately following the court decision, 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.
His Republican-led House may vote to repeal the law, but Obama's fellow Democrats in the Senate likely would block that.
Democrats hailed the court ruling as vindication for a longtime healthcare reform champion, the late Senator Ted Kennedy. House Democratic leader Nancy Pelosi said she called his widow Vicki Kennedy to say: "Now, Teddy can rest."
Shares of hospital chains jumped, while large health insurer stocks fell after the ruling. Widening the pool of paying patients stands to benefit hospital companies, which are often left to cover the high medical bills of the sick who have no coverage.
Shares of HCA Holdings and Community Health Systems, the two largest hospital companies, each rose sharply.
Shares of large, diversified health insurers such as Aetna and WellPoint were off about 4 percent and 6 percent, respectively. Investors might have viewed overturning the law as a better outcome for the companies, Goldman Sachs analysts said, leading to the selling pressure.