PHILADELPHIA (AP) — A federal judge on Wednesday blocked the U.S. government from withholding a major grant that pays for public safety equipment because Philadelphia is a "sanctuary city."

U.S. District Judge Michael Baylson said in his decision that he weighed the public interest and possible harm that could come from withholding such funds.

"Both the federal government and the city of Philadelphia have important interests at stake here and the court does not minimize either of their concerns," the judge wrote. "In this case, given Philadelphia's unique approach to meshing the legitimate needs of the federal government to remove criminal aliens with the City's promotion of health and safety, there is no conflict of any significance."

Baylson is the latest in a number of federal judges around the country to block efforts by the Department of Justice to withhold funding from "sanctuary cities."

Last month, a U.S. district judge in Chicago denied a request by the DOJ to lift a national freeze on the policy. And a Seattle judge declined to throw out a lawsuit brought by Seattle and Portland, Oregon, calling the DOJ's threats "unconstitutionally coercive."

The Justice Department is reviewing the Philadelphia ruling and determining the next steps, spokesman Devin O'Malley said.

"In Philadelphia, 2017 homicides have already eclipsed 2016's numbers, and so-called 'sanctuary policies' further undermine public safety and law enforcement," he said in a statement.

As of Tuesday, the city had recorded 281 homicides, a 16 percent increase over same period last year, putting the city on track for its deadliest year since 2012.

However, Police Commissioner Richard Ross testified Oct. 26 that U.S. residents are much more responsible for crime in Philadelphia than non-citizen immigrants, the judge said in his ruling.

"There is no evidence in the record whatsoever that non-citizens in Philadelphia commit any more crimes than the citizens," he wrote.

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 sued Attorney General Jeff Sessions in August over the conditions that had been added to the grant program, calling them unconstitutional and capricious.

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.

"Today's ruling benefits every single Philadelphia resident," said Mayor Jim Kenney. "Our police officers and criminal justice partners will receive much-needed federal funding, and our city will be able to continue practices that keep our communities safe and provide victims and witnesses the security to come forward."

District Attorney-elect Larry Krasner has vowed to stop the Trump Administration's immigration policies.

"This is clearly another defeat of Donald Trump's un-American agenda by an independent judiciary," said Krasner's spokesman, Ben Waxman. "DA-Elect Krasner has made clear that policies that force immigrants into the shadows ultimately make us all less safe."

For Philadelphia, more than $1 million authorized under the Edward Byrne Memorial Justice Assistance Grant Program was a stake.

The program is named after a New York City officer killed in 1988 while protecting an immigrant witness who'd agreed to testify against drug dealers.