The powers delegated to the federal government under the U.S. Constitution, James Madison wrote in Federalist 45, are "few and defined." But what happens when the federal government goes beyond those limited and enumerated powers? According to Madison, that's when the constitutional system of checks and balances kicks in.
One powerful check is provided by the judiciary, which Madison described to Congress in 1789 as "an impenetrable bulwark against every assumption of power in the legislative or executive." If only his description of the courts held true in more cases.
Another key check is provided by the states. "Should an unwarrantable measure of the federal government be unpopular in particular states, which would seldom fail to be the case," Madison wrote in Federalist 46, "the means of opposition to it are powerful and at hand." For one thing, the federal government would be forced to contend with "the disquietude" and "perhaps refusal" of the people of those particular states "to co-operate with the officers of the union." There would also be "the frowns of the executive magistracy of the state" and the "embarrassments created by [state] legislative devices" for the feds to tangle with. In short, federalism is supposed to help slam the brakes on an out-of-control federal government.
Which brings us to the Trump administration's unconstitutional attack on sanctuary cities, which are those jurisdictions that either decline to help the federal government round up and deport undocumented immigrants or otherwise refrain from enforcing federal immigration statutes.
The case for sanctuary cities is pure Madison. Because the federal government has no delegated power to commandeer state officials and force them to carry out federal schemes, state and local officials in sanctuary jurisdictions are simply reaffirming their basic 10th Amendment right to refuse to do Washington's bidding.
The federal courts clearly support the states in this fight. As the late Justice Antonin Scalia observed in his 2007 majority opinion in Printz v. United States, "the Federal Government may neither issue directives requiring the States to address particular problems, nor command the States' officers, or those of their political subdivisions, to administer or enforce a federal regulatory program."
As for the Trump administration's various threats to withhold, terminate, or "claw-back" federal funding for sanctuary cities, those threats would also violate the Constitution if the federal government carried them out. As the Supreme Court ruled in 2012 when it voided the Obamacare Medicaid expansion, which would have cut off all Medicaid funding for any state that refused to expand the program in accordance with the federal edict, federal "economic dragooning" of the states is unconstitutional because it "leaves the States with no real option but to acquiesce."
Here's a good rule of thumb: If you find yourself picking between the constitutional views of James Madison and Donald Trump, always let Madison be your guide.