Liberals are upset about President Trump's executive orders on immigration. But it may be conservatives who unwittingly throw the biggest wrench in one of the

central pieces of these orders.

Last Wednesday, the president signed an executive order to explore options to withhold federal funding from sanctuary cities — which harbor illegal immigrants who might otherwise be deported by the feds — if they resist complying fully with his impending crackdown on undocumented immigrants. Liberal leaders immediately vowed to defy President Trump.

New York City Mayor Bill de Blasio thundered that the order "won't change how we enforce the law in New York City." Likewise, Chicago Mayor Rahm Emanuel vowed that his city would remain a sanctuary. "There is no stranger among us. We welcome people, whether you're from Poland or Pakistan, whether you're from Ireland or India or Israel, and whether you're from Mexico or Moldova, where my grandfather came from, you are welcome in Chicago as you pursue the American Dream," Emanuel said.

Amen to such noble sentiments!

But the fact of the matter is that when nobility gets expensive, you get less of it. That's why undocumented workers are lucky that they don't have to count on liberal goodwill alone. They also have the law on their side — thanks to all the conservative Supreme Court justices who rejected ObamaCare's efforts to coerce states into embracing Medicaid expansion by stripping them of federal dollars.

Let's back up for a moment.

The sanctuary city movement began in 2008, when a few dozen localities started resisting President George W. Bush's controversial SECURE Communities program. Bush's program required local authorities to share the fingerprints of all arrestees — legal and illegal, citizens and foreigners — for a run through a federal database to make sure they were in the county legally. Anyone who couldn't get Immigration and Customs Enforcement (ICE) clearance was supposed to be detained by local authorities for up to two days till federal agents whisked them away for deportation, regardless of how trivial the original crime or whether they were even found guilty.

The sanctuary city movement eventually grew to include about 550 cities under President Barack Obama, who vastly expanded this program and deported two million undocumented workers, before finally winding it down in 2012. Now President Trump has vowed to restore it.

Trump makes it sound like this is meant to ferret out hardened criminals that sanctuary cities are harboring just to poke Uncle Sam in the eye. That's why he painstakingly named all the Americans killed by undocumented immigrants when announcing his crackdown. But that is patently absurd: There is no locality that shelters individual immigrants convicted of violent offenses. The issue only concerns mass deportation of foreigners who have committed minor offenses.

The SECURE Communities program forced too many local law enforcement resources to be diverted to low-level undocumented offenders instead of being focused on truly violent criminals. This made American communities less, not more, safe. It also sowed fear and resentment toward local police among targeted Latino communities, many of which just stopped reporting crimes.

The wait-for-ICE detentions were also almost certainly unconstitutional. They required holding people without a warrant beyond the time required by the original crime. (For example, someone booked for unpaid parking tickets could end up being detained for days and then deported.) For all these reasons, many cities developed internal policies of non-cooperation. Some states, like California, even passed laws barring local cooperation.

But all these communities would have to rethink their brave stance if Trump could make good on his threat of stripping them of federal money.

It's a good thing, then, that the president can't do that — thanks in large part to the conservative justices in the National Federation of Independent Business v. Sebelius – aka the ObamaCare ruling.

Joined by two liberals, all five conservative justices basically declared null and void an ObamaCare provision that would have stripped states that refused to expand Medicaid of all their Medicaid funding — not just the money tied to the expansion pushed by ObamaCare. The justices agreed that this was "coercion," and that Uncle Sam does not have limitless authority to withhold "non-germane" funds that don't have anything to do with the policy in question.

This ruling is a huge legal problem for President Trump's attempts to withhold non-immigration-related federal funding from sanctuary cities. Sure, he can go after germane funds. That means Department of Justice and DHS grants that are tied to immigration enforcement are fair game. But little beyond that may be in play, as Bill Ong Hing, a law professor at the University of San Francisco and the founder of the Immigrant Legal Resource Center, told Politico. All in all, the DOJ funds at risk add up to just $600 million nationally. Even if Trump could find more funds to scrap, it would be tantamount to a drop in the bucket considering that San Francisco alone receives $1 billion annually from the federal government.

Most sanctuary cities will likely be able to withstand this kind of a hit. And as a result, their huddled masses might be saved from Trump's tentacles.

But there's another big cost that will hamstring this sanctuary city crackdown: If he can't command local cooperation by threatening to cut funds, then President Trump also can't de facto deputize local law enforcement agents. So he will have to cough up large sums of federal money to triple the size of the federal deportation force that would be required to eject millions of additional people.

And that will also mean bad optics, because without cooperative local authorities, President Trump will not be able to order ICE agents to whisk away all of these folks quietly in the dead of the night, shielded from media cameras. Instead, he'll have to start raiding schools, neighborhoods, and workplaces, which will make for terrible publicity.

Whether Trump will go that far remains to be seen. But thanks primarily to the conservative justices on the Supreme Court, it'll be very hard for him to do so. And that gives undocumented workers far more of a chance than if they had to depend only on the good intentions of local liberal politicians.

The irony is that these immigrants would be in much bigger trouble if Justice Sonia Sotomayor, along with her liberal colleague Ruth Bader Ginsburg, had prevailed in the ObamaCare ruling, as many liberals had hoped at the time. They were completely on board with ObamaCare's efforts to use federal funds to strong-arm states.

So what's the lesson? That standing up for bedrock checks and balances is a far better protector of vulnerable minorities than do-gooding liberal politics.

This column originally appeared in The Week