New York officials argue that such policies are vital to maintaining the trust of the city’s three million immigrants, including more than one million New Yorkers who are undocumented or live in a mixed status household.

Last month at a news conference in the city, Matthew T. Albence, ICE’s acting director, blamed New York’s sanctuary policies for the rape and murder of a 92-year-old woman in Queens. Mr. Albence said that the undocumented immigrant charged in the case should have been turned over to ICE months before, after he was charged with attacking his father.

New York, Mr. Albence said, had put public safety at risk by refusing to honor the agency’s so-called detainer in the case. ICE uses detainers to ask local law enforcement to hold undocumented immigrants until the agency can pick them up.

Soon after, ICE announced dozens of arrests around New York of undocumented immigrants, more than half of whom it said had been released despite detainers. “Local jurisdictions that choose to not cooperate with ICE are likely to see an increase in ICE enforcement activity,” the agency said in a statement. ICE has since issued similar statements about arrests in other sanctuary jurisdictions, including Chicago and Philadelphia. The agency also issued subpoenas to the city seeking more information about undocumented immigrants in its custody.

Highlighting the issue last Tuesday during his State of the Union address, Mr. Trump cited the killing in Queens as an example of how local officials were ordering the police “to release dangerous criminal aliens to prey upon the public.”

The next day, federal authorities announced that New York residents would be barred from travel programs like Global Entry because of a new law that allows undocumented immigrants in the state to obtain driver’s licenses while blocking the Department of Homeland Security from gaining access to state motor vehicle data. (On Monday, New York’s attorney general sued the federal government over the move.)