WASHINGTON — The Supreme Court is set this week to decide the politically charged constitutional clashes between President Obama and Republicans over his healthcare law and his immigration enforcement policy.

By most accounts, the justices must make a stark, clear choice either to endorse Obama’s policies — including the mandate for all to have health insurance — or to strike them down as flatly unconstitutional.

But the justices could rule in unexpected ways that would allow both sides to claim a victory.

Since the spring, when Obama’s lawyers were hit with hostile questions at oral arguments, the administration has faced the prospect of a resounding double defeat. It appeared the court’s more conservative justices could strike down the entire healthcare law and rule that Arizona and other states were free to arrest and jail illegal immigrants. Many people are predicting just that.

But Chief Justice John G. Roberts Jr. has said he hopes to avoid momentous rulings that turn on a 5-4 vote, and both cases offer the justices options that have been overlooked.

The healthcare case has been fiercely debated as a test of whether Congress can require individuals to buy health insurance under its power to regulate commerce. Opponents have likened it to forcing Americans to buy healthy food, such as vegetables.

Lurking in the background is a way to decide the case on tax law grounds. No one can be prosecuted, punished or fined for violating the mandate. In fact, the word “mandate” does not appear in the law. In “practical operation,” the administration argued, it’s just a tax law.

If the mandate is really just a tax, that would be supported by the Constitution, which says Congress “shall have the power to lay and collect taxes … to provide for the common defense and general welfare.”

So, in the end, the justices could agree the law’s required tax payments are constitutional, while also making clear the government does not have broad power to mandate purchases.

Late last year, Judge Brett Kavanaugh of the U.S. Court of Appeals in Washington, an influential appointee of President George W. Bush and a friend of the chief justice, wrote an opinion arguing for treating the mandate as a tax law, not a regulation of commerce.

During oral arguments in March, the conservative justices sounded highly skeptical of giving the government the power to mandate purchases. But at one point, liberal Justice Sonia Sotomayor asked whether it would be constitutional for Congress to assess a tax for health insurance and include an exemption for everyone who had insurance.

“The government might be able to do that,” said Paul D. Clement, the lawyer for the Republican states suing to overturn the healthcare law. If so, the liberals asked, why can’t Congress require people to have private insurance or pay a tax penalty?

Having the law upheld on tax grounds would be a big win for the president.

“It’s a neat way out of the box and the most reasonable way to uphold the law,” said Washington lawyer Andrew Pincus. But it also would give Republicans fodder for arguing that the healthcare law means new taxes, a claim Obama disputed when the legislation was being debated.

There are several other possibilities. The court could uphold the law as a regulation of commerce because healthcare is unique. Or the justices could strike down the entire law.

If the court were to strike down the mandate while upholding the rest of the sweeping law, both sides could claim victory. The Republicans could say Obama and the Democrats were slapped down for violating the Constitution. The president and his allies could say the insurance reforms and the expansion of Medicaid would provide better healthcare to millions of Americans.

A ruling in the Arizona immigration case also could leave both sides claiming a win. At issue is whether states can enforce laws against illegal immigrants, or whether such power rests solely with the federal government.

Two years ago, the Arizona Legislature, frustrated over federal inaction, told police to check whether people they stopped for some other reason were in this country legally. Its SB 1070 also made it a state crime for illegal immigrants to seek work or to fail to show proper documents. Before the law could take effect, however, the Obama administration sued and won rulings that put key provisions on hold.

During the Supreme Court arguments in April, Roberts and several liberal justices suggested they would uphold the “stop and question” part of Arizona’s law but would block the provisions that made it a crime to be an illegal immigrant.

The Immigration and Nationality Act says federal authorities have the final word on who is deported, but it also says states may “cooperate” in the “identification, apprehension and detention” of illegal immigrants.

The most disputed provision in the Arizona law tells police that when they make a lawful stop, they must check the immigration status of any person they suspect is “unlawfully present in the United States.”

The chief justice said he saw no problem with this provision. Once the police detain a suspected illegal immigrant, they would contact federal officials. “It’s still your decision” on whether to hold or release the individual, Roberts told the administration’s lawyer.

On the other hand, the parts of the law creating separate state crimes — if upheld — would allow Arizona to send illegal immigrants to jail, even if federal authorities objected. The justices hinted they would probably block those provisions as conflicting with federal law.

If so, Arizona could claim its law had been upheld, but it would be a much weaker version of SB 1070.

In its final week, the court will also decide whether it is cruel and unusual punishment to sentence a 14-year-old to life in prison with no chance for parole, and whether the 1st Amendment protects a liar who claims to have won military honors.

The high court said it would issue decisions Monday, but the final rulings are not likely until Wednesday or Thursday.

david.savage@latimes.com