Washington — The US Supreme Court upheld President Obama’s health-care reform law in its entirety on Thursday, ruling that Congress did not exceed its authority in passing key parts of the massive 2010 statute.

In an unusual twist, five justices – including Chief Justice Roberts – determined that it was not within Congress’s power to enact the so-called individual mandate that requires every American to purchase a government-approved level of health insurance or pay a penalty.

But four justices joined Roberts in concluding that Congress was within its power to enact a tax as an encouragement for individuals to purchase the government-mandated level of health insurance.

“The individual mandate cannot be upheld as an exercise of Congress’s power under the Commerce Clause,” Roberts wrote. “That clause authorizes Congress to regulate interstate commerce, not to order individuals to engage in it.”

He added: “In this case, however, it is reasonable to construe what Congress has done as increasing taxes on those who have a certain amount of income, but choose to go without health insurance. Such legislation is within Congress’s power to tax.”

In their dissent, four justices criticized Roberts for rewriting the health-care law to conform with the chief justice’s tax approach.

“The holding that the individual mandate is a tax raises a difficult constitutional question ... that the court resolves with inadequate deliberation,” wrote the justices, Antonin Scalia, Anthony Kennedy, Clarence Thomas, and Samuel Alito.

“The values that should have determined our course today are caution, minimalism, and the understanding that the federal government is one of limited powers,” they wrote.

“But the court’s ruling undermines those values at every turn. In the name of restraint, it overreaches. In the name of constitutional avoidance, it creates new constitutional questions. In the name of cooperative federalism, it undermines state sovereignty."

The dissenting justices said they would have invalidated the entire health-care reform statute.

As part of their ruling, the chief justice and his liberal colleagues upheld the constitutionality of a section of the law authorizing a major expansion of the federal Medicaid program. But the chief justice warned the government that its actions would violate the Constitution if it attempted to punish states refusing to participate in the reform by taking away all their existing Medicaid funding.

The high-court action marks a significant election-year victory for Mr. Obama and one of his top legislative priorities – the achievement of near-universal health-insurance coverage in the United States.

But it is unlikely to end efforts by Republicans in Congress and other critics to limit or repeal the controversial health-care reform law.

Administration lawyers defended the individual mandate as necessary to cover the extra cost of a broad package of generous health-insurance reforms, designed to make coverage more affordable to an additional 32 million Americans.

The mandate was deemed necessary by lawmakers to assemble a large enough risk pool to cover expensive provisions barring insurance companies from denying an individual coverage on the basis of a preexisting medical condition or charging higher premiums for the same reason.

Despite the endorsement of the high court, it remains unclear precisely how the expensive reforms will be funded and whether the law will ultimately reduce health-care costs in the country.