Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Baltimore Mayor Stephanie Rawlings-Blake replaced the city's police commissioner on Wednesday, saying the city needed to be more focused on suppressing a spike in violence in the months since the death of a man in police custody.

Rawlings-Blake said the police department under Commissioner Anthony Batts had become too preoccupied with internal politics and not enough with stemming a surge in shootings and killings.

"This was not an easy decision, but it is one that is in the best interest of Baltimore," the mayor said in a late afternoon news conference. "The people of Baltimore deserve better. The brave men and women of our department who put their lives on the line to make our cities deserve better."

Baltimore, historically one of America's most violent cities, has stumbled particularly hard, ending the first six months of the year with a 48 percent increase in homicides over the same period in 2014. That trend continued into July, with 10 killings in one week, including the shooting of three people Tuesday near the city's University of Maryland campus.

Baltimore Police Commissioner Anthony Batts, who was replaced Wednesday. Andrew Burton / Getty Images file

Of the 154 murders so far this year, more than half occurred since the April 19 death of Freddie Gray, who succumbed to injuries suffered while riding in the back of a police transport van. His death triggered looting and rioting and resulted in charges against six police officers.

To many, the timing of that backlash and the spike in murders is not coincidental.

Since Gray's death, the relationship between police and the city's high-crime communities has suffered, making it harder for cops to patrol streets and investigate cases, officials say. Arrests have plummeted, sparking accusations of a deliberate police slowdown.

At the same time, officials have blamed some of the violence on the looting of pharmacies and methadone clinics, which may have put a glut of opiates on the black market, triggering drug feuds.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Local crime experts told NBC News that the initial spike in killings likely fueled waves of retaliatory violence, further pushing the murder rate up.

"Gun violence has a cyclical aspect to it. It can operate like a contagion: one shooting leads to another, then leads to another, then leads to another," said Daniel Webster, director of the Johns Hopkins Center for Gun Policy and Research. "So while there may have been a small number of events that occurred initially, they got many more people out there looking for revenge."

"It was almost the perfect storm of circumstance," former Deputy Baltimore Police Commissioner John Skinner said.

The numbers back up that scenario. From April 19 to the end of June, there were 80 homicides in Baltimore, nearly double the 42 committed during the same period last year, according to an NBC News analysis of city crime data through the first half of the year. By comparison, there were 53 homicides during that period in 2013, 48 in 2012, and 45 in 2011.

There is a similar pattern among shootings. There were 171 people hit by gunfire between April 19 and the end of June, up from 77 in 2014. The year before, there were 103 during that period. In 2012, there were 77, and 88 in 2011.

As the deaths mounted, Batts came under increasing pressure to put a lid on the violence. On Wednesday, Rawlings-Blake ran out of patience, saying that he'd become distracted by trying to shore up internal support.

in addition to the criminal probe of Gray's death, the department is under investigation by the U.S. Justice Department for possible civil rights violations.

The firing came a day after the police union that criticized Batts' leadership during the riots, and Batts' own announcement of an independent review of the riot response.

"It is clear that the focus has been too much on the leadership of the department and not enough on the crime fighting," the mayor said.

Rawlings-Blake introduced Deputy Police Commissioner Kevin Davis as his temporary replacement.

At the news conference, Davis outlined his priorities: go after the relatively small number of hard-core criminals responsible for the city's deadly violence, improve the department's relationship with the public, and boost morale within the force.

"This is a time of refocusing and re-energizing and going after the folks who are harming this community," Davis said. "And at the same time we need to serve the community."

Skinner said that is exactly the path city needs to pursue.

"With this leadership change, the department and the city itself really needs to get back to the basics of policing," he said.

That means a return to foot patrols in high-crime neighborhoods, a stronger push to regain the public's support, and a focused effort on rounding up the city's worst criminals.

The last part is already underway, on a limited basis, with programs that seek to de-escalate beefs and confront street criminals believed to be responsible for gun violence. But organizers have complained about a lack of resources.

"Whatever change there is, it needs to be swift," Skinner said. "Baltimore needs to achieve some sort of stability. The department, and the city itself."