The US attorney in Philadelphia is blaming the city’s left-leaning new district attorney for the jeering mob that taunted cops during a gunman’s wild shootout that left six officers injured Wednesday.

DA Larry Krasner has championed a “new culture of disrespect for law enforcement” that led to the anti-cop incidents, top federal prosecutor William M. McSwain said Thursday.

The federal prosecutor’s criticism came as Philadelphia Police Chief Richard Ross told reporters that the weapons used by shooting suspect Maurice Hill were a handgun and a military-style AR-15.

“What I witnessed last night was true heroism by the Philadelphia police,” McSwain wrote in a statement to the press.

“But the crisis was precipitated by a stunning disrespect for law enforcement — a disrespect so flagrant and so reckless that the suspect immediately opened fire on every single officer within shooting distance.

“Only by the grace of God did they survive.”

The disrespect began a year and a half ago at Krasner’s victory party, which featured “chants of ‘F*** the police” and “No good cops in a racist system,” McSwain wrote.

Since then, law enforcement has endured “the worst kinds of slander,” McSwain wrote, including Krasner, a long-time civil rights lawyer, calling cops “racist” and “corrupt” and comparing them to Nazi “war criminals.”

“The vile rhetoric puts our police in danger,” McSwain wrote. “It disgraces the Office of the District Attorney. And it harms the good people in the City of Philadelphia and rewards the wicked.”

Krasner did not immediately offer any response.

The former defense attorney ran for office last year on a platform of criminal justice reform. Since he took office in January, he has caused controversy with actions such as dropping the DA office’s opposition to giving infamous convicted cop killer Mumia Abu-Jamal a new appeals hearing.

The unruly, cop-hating crowd had converged at the home of Hill, 36, after cops attempting to serve a drug warrant there found themselves in a nearly eight-hour standoff and shootout.

By the time he surrendered, six cops were injured.

The shootout prompted President Trump to tweet, “Long sentence — must get much tougher on street crime!”

Related Video Video length 46 seconds :46

President Trump mentioned the Philadelphia shooting in speaking with reporters Thursday, in calling for “strong, meaningful background checks where people should not have guns, people who are insane, mentally ill, bad, bad people, like this guy in Philadelphia who has been arrested numerous times.”

With Post wires