IN GRAPPLING with its worst epidemic of homicides in years, Chicago faces no more critical task than repairing frayed relations between its beleaguered police force and the communities it serves. Now the Trump administration, more eager to advance its anti-illegal- immigration agenda than to combat violent crime, is throwing up obstacles that will make it more difficult for Chicago and other localities to get a grip on the problems they confront.

After a federal court blocked the administration’s crusade to punish so-called sanctuary cities such as Chicago by withholding an array of federal funds, the Justice Department has renewed the effort in a more targeted way, declaring that localities that refuse to cooperate with deportation agents are ineligible for a specific grant program for police departments.

If that sounds illogical, it’s because it is. Despite President Trump’s assertions to the contrary, there is no evidence that illegal immigration has contributed to Chicago’s murder spree. Eddie Johnson, the city’s police superintendent, said “the vast majority” of Chicago’s violent crime “is committed by homegrown people,” while illegal immigrants are a “nominal” factor. And while the city does prohibit cooperation with federal deportation agents in most instances, it makes exceptions for convicted and charged felons, as well as suspected gang members.

Nonetheless, Attorney General Jeff Sessions justifies barring the federal grants to Chicago — thereby impeding its ability to buy crime-fighting gear such as police cars, SWAT equipment and radios — by falsely linking the Windy City’s homicide rate with its sanctuary policies. “The city’s leaders cannot follow some laws and ignore others and reasonably expect this horrific situation to improve,” he said.

Irked at Chicago’s defiance, and that of other cities and counties, Mr. Sessions demands, as a condition for the law enforcement grants, that Immigration and Customs Enforcement agents be granted unfettered access to city jails and police stations to interview suspected illegal immigrants in custody; 48 hours’ notice of an inmate’s release if ICE agents want to detain him or her; and that local police share detainees’ immigration status with ICE.

The trouble with Mr. Sessions’s demands is that they would undermine local law enforcement by driving a wedge between police and immigrant communities. As many police chiefs have pointed out, witnesses, victims and others in such neighborhoods are less likely to report crimes and cooperate with police if they think officers are working hand-in-glove with federal deportation agents.

Chicago responded to the administration’s funding conditions this week by suing Mr. Sessions. The dollars at stake for Chicago — $3.2 million this year in federal Byrne grants — are minuscule measured against the city’s $9.8 billion annual budget. Nonetheless, Mayor Rahm Emanuel (D) justifiably fears that acquiescence sets a bad precedent by allowing the executive branch to impose funding conditions unilaterally, without authorization by Congress, which enacted the grant program in the first place.

Sanctuary policies are grounded in legitimate concern that working with deportation agents subverts local law enforcement. As long as localities use common sense — cooperating with federal agencies on dangerous criminals who should be deported — they should not be hounded by Washington.