BALTIMORE — The Baltimore mayor fired the troubled city’s police commissioner Wednesday, saying that a recent spike in homicides weeks after an unarmed black man died of injuries in police custody required a change in leadership.

Mayor Stephanie Rawlings-Blake thanked Police Commissioner Anthony Batts for his service — and praised the job he had done — but said growing criticism of his leadership had become a “distraction” that was preventing the city from moving ahead.

Deputy Police Commissioner Kevin Davis, who has only been with the department since January, will serve as interim commissioner, Rawlings-Blake said.

“We need a change,” the mayor told a news conference, which was attended by Davis by her side. “This was not an easy decision but it is one that is in the best interest of Baltimore. The people of Baltimore deserve better and we’re going to get better.”

The firing comes 2½ months after riots broke out in the city following the death of Freddie Gray, who died in April of injuries he received in police custody. Six police officers have been criminally charged in Gray’s death.

After the violence, arrests in the city plummeted and homicides spiked. On Tuesday night, gunmen jumped out of two vans and fired at a group of people a few blocks from an urban university campus, killing three people. A fourth person sought treatment for a gunshot wound to the buttocks and was in stable condition.

Police said Wednesday that the shooting wasn’t random, but no arrests have been made.

“As we have seen in recent weeks, too many continue to die on our streets, including three just last night and one earlier today,” Rawlings-Blake said. Referring to Batts, she said that “recent events proved that his being here was a distraction.”

“A key goal of my administration is making Baltimore a safer place. We cannot continue to debate the leadership of the department. We cannot continue to have the level of violence we’ve seen in recent weeks in this city. We have made progress; I don’t want to lose that progress.”

On Tuesday, the police department announced that an outside organization will review the department’s response to the civil unrest that followed Gray’s death. Most of the unrest took place on April 27, prompted by Gray’s death on April 19.

In the meantime, the US Justice Department is conducting a civil rights review of the department, and the Baltimore police union released its own scathing post-mortem report Tuesday.

Batts and other top brass instructed officers not to engage with rioters and to allow looting and destruction to occur, according to the report from the Baltimore Fraternal Order of Police Lodge 3. The report also says officers were told not to wear protective gear, and to request permission from the department’s legal section before making arrests.

“Officers stated they lacked basic riot equipment, training and leadership,” union president Kevin Ryan said in the report. “The officers repeatedly expressed concern that the passive response of the Baltimore police commanders to the civil unrest allowed the disorder to grow into full-scale rioting. … The riots were preventable.”

Following Batts’ firing Wednesday, the union issued a statement reiterating the report’s concerns but also expressing hope for the future.

“We look forward to working with Interim Commissioner Kevin Davis to unite the Baltimore Police Department and move both our department and city forward,” it said.

The mayor said that in addition to reducing crime, Davis would “bring accountability to police, hold officers who act out of line accountable for their actions.”

In his own remarks at the news conference, Davis said his goals would also include improving the relationship with the officers who work for him. “A relationship must exist with the rank and file,” he said. “I will walk with them and serve with them and be with them every step of the way.”

Davis was previously chief of police in Anne Arundel County, Maryland, and assistant chief in Prince George’s County, Maryland. He joined the Prince George’s department in 1992 and worked his way up the ranks.

He led the Anne Arundel department for a year and a half, coming in after political scandals involving a county executive and a police chief. Davis resigned from the Anne Arundel department in December after the election of a new county executive.

Rawlings-Blake appointed Batts as police commissioner in September 2012.

His contract with the city paid him $190,000 and was to run through June 2020. It includes a provision for a severance payment equal to his annual salary if he is terminated without cause.