The purity level of heroin seized by drug agents on the streets of American cities has grown significantly in recent years, federal officials say, rising to 50 percent from 5 percent in St. Louis in the past several years, and as high as 90 percent in Philadelphia.

In a trend mimicked in large cities nationally, many of the heroin consumers in St. Louis are young whites in their 20s, who drive into the city from suburbs and distant rural areas, the police say. And while most heroin overdose victims here are white, nearly all of the shooting victims and suspects in St. Louis this year have been African-American men and boys, police data shows.

“What I’m seeing at street level are violent disputes about money owed around heroin debts, with sometimes the dispute being about money, and sometimes about drugs,” said D. Samuel Dotson III, the police chief of St. Louis.

In 2014, St. Louis had the highest homicide rate of any city with more than 100,000 people. Its 157 homicides that year increased by 18 percent in 2015 to 188, and while the rate has slowed in the initial months of this year, St. Louis is again on pace to be among the nation’s most dangerous big cities.

The heroin problem has been difficult for the city’s leaders to ignore. Those who have succumbed to the drug include a nephew of Steve Stenger’s, the St. Louis County executive, who died from an overdose in 2014. A brother of Mayor Francis Slay’s was arrested on a charge of heroin possession in 2012, and the stepson of Jennifer Joyce’s, the city’s top prosecutor, was arrested on the same charge last month.

“These heroin addicts are daughters, sons, husbands, wives or, in my case, a brother,” Mr. Slay told reporters last month.