The Justice Department knocked New York for being “soft on crime” on Friday — vowing to close the spigot on federal funds if Gotham maintains its “sanctuary city” status.

The cuts would ironically include money for a grant program named after an NYPD officer slain while protecting an immigrant.

“New York City continues to see gang murder after gang murder, the predictable consequence of the city’s ‘soft on crime’ stance,” Justice officials charged in a press release announcing the June 30 deadline.

Police Commissioner James O’Neill called the agency’s accusation a “willful disregard for the facts,” highlighting the city’s dramatic and steady decline in violent crime over the last three decades.

“I’d like to think of myself as a pretty calm and measured person. I think most of the time I present myself that way,” he added. “But when I read that statement by DOJ this afternoon my blood began to boil.”

The bitter back and forth came as the feds warned they’ll withhold money from the Edward Byrne Memorial Justice Assistance Grant Program if city officials don’t prove they’re complying with the law.

The program is named after Eddie Byrne, an NYPD officer gunned down in 1988 while guarding the home of an immigrant who had been targeted by gangs for reporting serious crimes in the neighborhood.

Attorney General Jeff Sessions speaks during a press conference in Washington, D.C.

(NICHOLAS KAMM/AFP/Getty Images)

The move is the latest in a continuing effort by Attorney General Jeff Sessions to punish cities for protecting undocumented immigrants from deportation.

“This is an insult, this statement,” he said. “And it suggests that everything that’s been achieved didn’t happen.”

The year Byrne was murdered, the Big Apple saw 1,896 homicides. Last year, there were only 335 murders, part of a record-low crime rate for the city and an 85% decrease in the murder rate since the city’s bloody peak of 2,245 murders in 1990.

The feds hit back with a statement squarely aimed at Hizzoner’s protection of undocumented immigrants.

“Those policies, implemented by New York City’s mayor and his administration, are directly responsible for a dangerous MS-13 gang member walking out of Rikers Island in February,” the agency said, referencing the release of 19-year-old Estivan Velasquez.

Immigration and Customs Enforcement deported the alleged gang member after his release, blasting the city for not handing over the Salvadoran immigrant.

On Friday, the Trump administration sent letters to officials in California and eight cities. It demands that they provide documentation that they aren’t blocking local officials from sharing information about the immigration status of “any individual” they’ve come across with federal officials.

“Failure to comply with this condition could result in the withholding of grant funds, suspension or termination of the grant, ineligibility for future grants or subgrants, or other actions, as appropriate,” Acting Assistant Attorney General Alan Hanson said in letters to the cities.

At stake is roughly $29 million in law enforcement aid under the Edward Byrne Memorial Justice Assistance Grant Program, which helps local governments pay for everything from forensics labs to drug courts.

New York received $4.3 million from the grant in 2016, according to the Department of Justice.

The letters warn officials they must provide proof from an attorney that they are following the law or risk losing federal money that police use for anything from body cameras to bulletproof vests.

Sessions did find a few supporters in the city. “Despite what some politicians may think, law enforcement does not get to choose the laws we uphold,” Sergeants Benevolent Association Ed Mullins said in a statement. “Attorney General Sessions is absolutely correct to hold New York and other jurisdictions accountable for their so-called ‘sanctuary policies.’ ”