PHILADELPHIA — A federal judge ruled Wednesday that the Trump administration cannot cut off grants to Philadelphia over the way the city deals with immigrants in the country illegally.

U.S. District Judge Michael Baylson said in his ruling that the conditions the federal government placed on the city in order to receive the funding are unconstitutional, “arbitrary and capricious.” He also wrote that Philadelphia’s policies are reasonable and appropriate.

Philadelphia has said it will turn over immigrants to Immigration and Customs Enforcement only if the agency has a warrant signed by a judge.

The federal requirements included allowing Immigration and Customs Enforcement officers access to prisons to interview people of interest, providing advanced notice of release of those people and following rules prohibiting restrictions on disclosure of any person’s immigration status.

“The public statements of President (Donald) Trump and Attorney General (Jeff) Sessions, asserting that immigrants commit more crimes than native-born citizens, are inaccurate as applied to Philadelphia, and do not justify the imposition of these three conditions,” Baylson wrote.

Federal attorneys had said the city’s policies put federal immigration agents in danger and create situations where criminals in the country illegally are released and allowed to reoffend.

A spokesman for the city said Wednesday afternoon that staff was reviewing the ruling. A request for comment from the Department of Justice was not immediately returned Wednesday.

The city had said that the requirements on federal grant spending were unconstitutional and that following them would promote a perception in the community that it was serving as an arm of federal immigration enforcement. City attorneys had argued that would create a barrier for immigrants to seek out city services ranging from health care to calling the police when they’re victimized.

Baylson wrote that Philadelphia is entitled to prompt payment of the grant funds, but he has given the city and Justice Department time to suggest language for a final decree making that an order.

Several other “sanctuary cities” have opted to limit cooperation with government enforcement of immigration law. The Justice Department has threatened to cut off millions of dollars in federal grants to cities if they don’t meet certain criteria for cooperating with immigration officials. Philadelphia’s attorneys had argued the move is unconstitutional and that it harms residents by withholding money earmarked to help buy kits to counteract opioid overdoses.

Sessions has said that cities that don’t help enforce immigration law are endangering public safety, especially when it comes to sharing information about immigrants who have been accused of crimes.

A federal appeals court in April sided with Chicago in a similar dispute.

RELATED

Appeals court to hear more arguments over sanctuary cities injunction in Chicago
Sanctuary cities could get boost from sports betting ruling
Trump rails against sanctuary cities amid immigration talks