GLOUCESTER, Massachusetts — Like many unsuspecting communities, Gloucester, Massachusetts, woke to its heroin problem with a sudden rash of overdoses.

Four deaths in three months was catastrophic for Gloucester, a small fishing town that tended to keep its addictions quiet.

What happened next put the city at the center of a shift in American policing that could alter the course of the war on drugs.

The cops offered addicts help.

Gloucester Police Chief Leonard Campanello on the job. Gloucester Police Department

Police Chief Leonard Campanello announced the new initiative in a May 2015 Facebook post: Come to us, and we'll get you into treatment. Word spread. Dozens of law enforcement agencies began doing the same thing. Campanello had to set up an umbrella nonprofit to organize the broadening project. He was invited to speak at conferences and was honored at the White House.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Campanello wasn't the only advocate of a new approach to deal with drug addiction. Across the country, police and prosecutors are embracing similar programs that divert nonviolent offenders away from jail and into programs to help beat their addictions. Some intervene before an arrest, and don't raise the threat of a charge, while others keep a potential charge as motivation. Many rely on medically assisted treatment rather than abstinence. Dozens of agencies are participating in one type of program, and dozens more are planning to.

This development has been driven by a growing acknowledgment that old methods of locking up addicts, which may have cut crime in the short term, did little to stem the flow of drugs into the country — or reduce the demand for them.

"It's done. It's over. It's lost. It wasn't a war on drugs. It was a war on addiction," Campanello said.

Gloucester police officers often travel with Narcan, a drug used to reverse the effects of heroin overdoses. Munir Atalla / NBC News

Not so long ago, that remark would have been considered blasphemy. But that was before drug overdoses soared to their highest point in history in 2014, the last year for which statistics are available. The increase was fueled by a surge in use of heroin and prescription painkillers, including a dramatic jump among young whites. That development challenged old notions, and biases, about opiate addiction, and prompted authorities to come up with new strategies.

"Heroin is now a white problem, is really what it boils down to," said John Urquhart, sheriff of King County, Washington, which includes Seattle. "It's in middle America, upper-class America. It's in the suburbs, it's in the high schools. That's what has gotten America's attention. It shouldn't be that way, but it is."

His agency was among the first to embrace an experimental program developed five years ago in Seattle in which officers hold off arresting low-level drug offenders in order to get them treatment. The city became a leader in the movement after police came under fire for targeting minorities in drug crackdowns. The department asked its critics what it could do to avoid a costly lawsuit, and their answer was to give officers the option to divert offenders into a program that could help them confront their addictions. Early studies indicate that participants are less likely to commit more crimes and that the city is saving money.

Other cities, including Santa Fe, New Mexico, Albany, New York, and Huntington, West Virginia, have adopted the program, called Law Enforcement Assisted Diversion. It's also been praised by the Obama administration as a potential model for correcting mistakes of the past.

"Part of what had made it previously difficult to emphasize treatment over the criminal justice system had to do with the fact that the populations affected in the past were viewed as — or stereotypically identified as —poor, minority," Obama said in a March panel on the opioid epidemic. "And, as a consequence, the thinking was it is often a character flaw in those individuals who live in those communities and it's not our problem they're just being locked up."

Chuck Wexler, who runs the Police Executive Research Forum, stressed that police still need to focus on going after dealers and high-level traffickers.

But he said there is a growing acknowledgment among law enforcement authorities that getting people help for their addictions can do more to cut crime than simply putting them in jail. And in some cities, he said, overdoses are outpacing murders.

"It is a recognition that the epidemic of overdoses required police to look at it from a public health standpoint as well as a law enforcement standpoint," he said.

David Rosenbloom, a professor at Boston University's School of Public Health who is tracking the results of Gloucester's program, said it will take years to understand how well it — and others — work, because addiction is a chronic condition that can be managed, like diabetes. Campanello says his department has so far referred more than 400 people to treatment.

"We’re seeing short term tends that are favorable in terms of lower rates of recidivism but it's very hard to draw conclusions," Rosenbloom said.

Campanello said that one of the first things he does when talking to addicts and their families is apologize.

"I say that, you know, 'We're sorry, as a law enforcement community, if we've treated you or your loved ones with less dignity, respect and compassion that you deserved. That's not our place. And we shouldn't have done it. And we hope to move on from that point, that we are recognizing the issue for what it is, finally, and trying something different.' And hope's a powerful thing."