Philadelphia’s police commissioner stepped down Tuesday amid allegations of sexual harassment and racial discrimination within the department.

The move — which was widely unexpected — comes less than a week after six PPD officers were shot and wounded during a gun battle with a drug suspect.

Commissioner Richard Ross Jr. had been praised for his handling of the Aug. 14 shooting and ensuing standoff. He’s also been credited with helping see the department through a social media scandal that it had to deal with last month — when 13 officers were suspended for allegedly posting hateful and racist content online.

Philly Mayor Jim Kenney said he was “disappointed” by Ross’ decision to step down, but understood why. He released a statement on Tuesday — explaining how the city’s top cop hadn’t been accused of any wrongdoing.

“Today, Commissioner Ross tendered his resignation,” Kenney said. “I am disappointed, because he’s been a terrific asset to the Police Department and the City as a whole.”

Kenney cited “new allegations of sexual harassment as well as gender and racial discrimination among the rank and file” as reasons why Ross — who started with the PPD in 1989 and was appointed to commissioner in 2016 — chose to resign.

“While those allegations do not accuse Commissioner Ross of harassment, I do ultimately believe his resignation is in the best interest of the Department,” the mayor said. “Last summer, the City implemented a new sexual harassment prevention policy and a series of internal reforms designed to prevent workplace discrimination and harassment throughout the government. While rolling out a new policy understandably takes time, I do not believe the Police Department has taken the necessary actions to address the underlying cultural issues that too often negatively impact women — especially women of color. I will be enlisting the help of an independent firm to investigate the recent allegations and to make recommendations to overcome some of the discrimination and harassment within the Department.”

Kenney said he was “grateful for Commissioner Ross’ many years of dedicated service” and “the many reforms he brought to the Department.” However, it wasn’t enough to keep him on board.

“I believe new leadership will help us continue to reform the Department and show that racial, ethnic, and gender discrimination simply will not be tolerated,” Kenney explained.

Deputy Commissioner Christine Coulter — who is one of four deputies working directly under Ross — will work as acting commissioner while officials search for a permanent replacement.

“Deputy Coulter is an experienced police commander with nearly 30 years of law enforcement service,” said Kenney. “She has diverse experience in patrol operations, narcotics intelligence, and investigations. I have full faith in her ability to lead the Department during this time of transition.”