Local identification cards in Middletown and Newburgh.

Andrew Napolitano, retired New Jersey Superior Court judge and senior judicial analyst for Fox News.

The United States Supreme Court decision that legalized sports betting.

What do they have in common? As Judge Andy explained to the shock of some of his Fox colleagues, the high court was ruling not just on betting but on the larger issue of whether the federal government can force local ones such as cities and states to help enforce federal laws.

That issue is at the heart of the controversy over sanctuary cities, the notion that a locality can choose whether and how far to cooperate with federal efforts to enforce immigration laws. That means the approach being taken by the City of Newburgh and its police department, as well as others, is not only wise and productive, it is legally protected.

Put aside the court’s reasoning for a moment and the police practices practically explain themselves.

A community with a large population of immigrants, both those with documentation and those without, can be a challenge for local enforcement. It starts with language, and local departments which take the trouble to hire bilingual officers see immediate advantages. It continues with trust, and departments that have earned the trust of those in the community see even more advantages.

And it continues even farther with information, the kind that those in the community provide to the police in efforts to solve past crimes and prevent future ones. Police know that if the community does not trust the department, that crucial flow of information slows dangerously.

Then consider what the federal government, or at least the current version of it, is asking. President Trump and Attorney General Sessions and others want to enlist local police in the enforcement of federal laws pertaining to immigration, no matter how broadly those are defined.

Local police here and elsewhere have made it clear. If somebody is suspected of committing a crime, one not related to his or her immigration status, then police will do what they do with all suspects in all criminal situations. They will investigate and make arrests if warranted. But they will not take the next step that the feds demand, they will not turn a routine traffic stop into an excuse to deport someone.

His friends on Fox and Friends were aghast when Judge Andy drew the line between sports betting and sanctuary cities, but he was merely the latest to point out the substantial and historic difference between federal and local authority. He just happened to be one they could not dismiss out of hand.

So Newburgh and Middletown and others are more free than ever to pursue the idea of local identification cards, something that will help local undocumented immigrants continue to live law-abiding, productive lives.

This might help end the distraction that the president and his supporters prefer over constructive solutions. What we need are not more arrests but more legislation, the long-promised, long-delayed path to citizenship for the undocumented.

You heard it from the Supreme Court. You heard it from Judge Andy. What else do you need?