LOS ANGELES – Republicans believed a Mitt Romney win would seal Obamacare’s fate. Democrats — or rather, the lonely two-fifths of Americans who support the president’s beleaguered health-care law — believed an Obama win would secure its future. Both sides were kidding themselves.

Romney may have pledged to repeal the law, but anyone who put stock in his pledge simply wasn’t paying attention.

Democrats are likewise deluding themselves if they think the law is safe because Obama wields the veto pen. The greatest threat to Obamacare was never a Romney presidency but Obamacare itself.

The law remains vulnerable because of its unpopularity, the compromises that unpopularity forced on its authors and the Supreme Court’s ruling that part of it is unconstitutional. These factors guarantee repeal will remain a viable issue, and I predict the president will ultimately sign a bill making major changes, at the very least.

In its ruling on the health-care law, the Supreme Court gave states the freedom to decline Obamacare’s costly Medicaid expansion. Insurers, hospitals and pharmaceutical companies were counting on the subsidies that came along with the expansion to offset the cuts and new costs the law imposes on them.

The fact that many states have said they won’t implement the expansion will lead to those groups putting pressure on Congress to reopen the law.

There is a similar problem with the law’s other entitlement program: the health insurance exchanges Congress created as a conduit for $800 billion in tax credits and subsidies whose purpose is to hide the cost of the law’s insurance provisions.

Obamacare’s instant unpopularity, and the fear of being accused of backing a federal takeover of health care, moved moderate senators such as Joe Lieberman, I-Conn., and Ben Nelson, D-Neb., to demand the exchanges be run by the states. The bill would not have cleared the Senate without that.

As the Supreme Court reaffirmed when it struck down the Medicaid mandate, however, Congress cannot constitutionally command states to implement a federal program.

Instead, the law asks each state to create an exchange, and orders the feds to create one in states that don’t.

Contrary to expectations, more than 30 states have refused to create exchanges or are dragging their heels. And with good reason: State-created exchanges bring higher taxes.

The very tax credits that are contingent on states implementing an exchange are also an essential part of the trigger mechanisms for the law’s penalties on employers and individuals who don’t purchase health insurance.

Since those tax credits are only available through state-created exchanges, states can exempt their employers from penalties of up to $2,000 per worker simply by not creating exchanges.

By my count, states can collectively exempt 18 million Americans from other penalties that, by 2016, will reach $2,085 on families of four earning as little as $24,000.

The repercussions would be tremendous. The purpose of those credits and subsidies is to hide the cost of the law’s mandates and regulations. Blocking them would not increase the law’s costs; it would reveal them to insurers and consumers. Under those circumstances, even vulnerable Democratic senators probably would demand that Congress reopen the law.

That seems likely: 14 states have enacted statutes or constitutional amendments that explicitly prohibit state employees from even assisting in the imposition of such penalties, a key function of an exchange.

True, the Internal Revenue Service is trying to impose those penalties even in states that don’t create exchanges. Oklahoma’s attorney general has sued to stop them, and additional lawsuits probably will follow. If any such lawsuits prevail, employers will flee states like California that have created exchanges to seek refuge in states such as Arizona, where those penalties do not apply. Even states that have been eager to implement the law would join the “reopen Obamacare” chorus.

Other legal challenges could also bring down the law. The Pacific Legal Foundation is challenging the individual mandate, which originated in the Senate, even though the Constitution requires that tax measures originate in the House. The mandate is also vulnerable because it is not uniform across all states. And more than 40 lawsuits allege the law violates the 1st Amendment’s protections of religious freedom.

Obamacare imposes too many costs on too many people and makes health care more costly and scarce, not less. It needs to go — and that can still happen.

Michael F. Cannon is director of health policy studies at the Cato Institute, a libertarian think thank. He wrote this for the Los Angeles Times.