BALTIMORE — Baltimore reached a grim milestone on Friday, three months after riots erupted in response to the death of Freddie Gray in police custody: With 43 homicides in July, the city has seen more bloodshed in a single month than it has in 43 years.

The 43rd recorded homicide was Jermaine Miller, 18, who took a bullet to his head just before noon the day before.

With his death on Friday, this year’s total homicides reached 187, far outpacing the 119 killings by July’s end in 2014. Non-fatal shootings have soared to 366, compared to 200 by the same date last year. July’s total was the worst since the city recorded 45 killings in August 1972, according to the Baltimore Sun.

The seemingly Sisyphean task of containing the city’s violence prompted Mayor Stephanie Rawlings-Blake to fire Police Commissioner Anthony Batts on July 8.

“Too many continue to die on our streets,” Rawlings-Blake said then. “Families are tired of dealing with this pain, and so am I. Recent events have placed an intense focus on our police leadership, distracting many from what needs to be our main focus: the fight against crime.”

But the killings have not abated under Interim Commissioner Kevin Davis since then.

Baltimore is not unique in its suffering; crimes are spiking in big cities around the country.

But while the city’s police are closing cases — Davis announced arrests in three recent murders several days ago — the violence is outpacing their efforts. Davis said Tuesday the “clearance rate” is at 36.6 percent, far lower than the department’s mid-40s average.

Crime experts and residents of Baltimore’s most dangerous neighborhoods cite a confluence of factors: mistrust of the police; generalized anger and hopelessness over a lack of opportunities for young black men; and competition among dealers of illegal drugs, bolstered by the looting of prescription pills from pharmacies during the riot.

Federal drug enforcement agents said gangs targeted 32 pharmacies in the city, taking roughly 300,000 doses of opiates, as the riots caused $9 million in property damage in the city.

Perched on a friend’s stoop, Sherry Moore, 55, said she knew “mostly all” of the young men killed recently in West Baltimore, including an 18-year-old fatally shot a half-block away. Moore said many more pills are on the street since the riot, making people wilder than usual.

“The ones doing the violence, the shootings, they’re eating Percocet like candy and they’re not thinking about consequences. They have no discipline, they have no respect — they think this is a game. ‘How many can I put down on the East side? How many can I put down on the West side?'”

The city’s official tally of 42 homicides recorded in May included Gray, who died in April after his neck was broken in police custody. The July tally likewise includes a previous death — a baby whose death in June was ruled a homicide in July.

Shawn Ellerman, assistant special agent in charge of the Baltimore division of the Drug Enforcement Administration, said May’s homicide spike was probably related to the stolen prescription drugs, a supply that is likely exhausted by now. But the drug trade is inherently violent, and turf wars tend to prompt retaliatory killings.

“You can’t attribute every murder to narcotics, but I would think a good number” of them are, he said. “You could say it’s retaliation from drug trafficking, it’s retaliation from gangs moving in from other territories. But there have been drug markets in Baltimore for years.”

Across West Baltimore, residents complain that drug addiction and crime are part of a cycle that begins with despair among children who lack educational and recreational opportunities, and extends when people can’t find work.

“We need jobs! We need jobs!” a man riding around on a bicycle shouted to anyone who’d listen after four people were shot, three of them fatally, on a street corner in July.

More community engagement, progressive policing policies and opportunities for young people in poverty could help, community activist Munir Bahar said.

“People are focusing on enforcement, not preventing violence. Police enforce a code, a law. Our job as the community is to prevent the violence, and we’ve failed,” said Bahar, who leads the annual 300 Men March against violence in West Baltimore.

“We need anti-violence organizations, we need mentorship programs, we need a long-term solution. But we also need immediate relief,” Bahar added. “When we’re in something so deep, we have to stop it before you can analyze what the root is.”

Strained relationships between police and the public also play a role, according to Eugene O’Donnell, a professor at John Jay College of Criminal Justice.

Arrests plummeted and violence soared after six officers were indicted in Gray’s death. Residents accused police of abandoning their posts for fear of facing criminal charges for making arrests, and said emboldened criminals were settling scores with little risk of being caught.

The department denied these claims, and police cars have been evident patrolling West Baltimore’s central thoroughfares recently.

But O’Donnell said the perception of lawlessness is just as powerful as the reality.

“We have a national issue where the police feel they are the Public Enemy No. 1,” he said, making some officers stand down and criminals become more brazen.

“There’s a rhythm to the streets,” he added. “And when people get away with gun violence, it has a long-term emboldening effect. And the good people in the neighborhood think, ‘Who has the upper hand?'”