Beny J. Primm, a doctor who started some of New York City’s first methadone clinics to treat heroin addicts in the 1960s and who, during the AIDS epidemic in the 1980s, became a nationally prominent advocate for changing public health policy toward intravenous drug users, died on Oct. 16 in New Rochelle, N.Y. He was 87.

His daughter Annelle Primm confirmed the death.

Dr. Primm was treating trauma cases at Harlem Hospital in the early 1960s when he became aware of the havoc that drug addiction was causing. “As an anesthesiologist, I saw young people in the E.R., their bodies riddled with bullet and knife wounds,” he wrote in his 2014 memoir, “The Healer: A Doctor’s Crusade Against Addiction and AIDS,” written with John S. Friedman. “I knew that behind this devastation was the scourge of drugs, and I made a promise to myself that I would work to stop these black kids from going down.”

In 1969, he founded the Addiction Research and Treatment Corporation, which opened a methadone clinic in the Fort Greene section of Brooklyn and, within a few years, a half-dozen treatment centers in Brooklyn and Manhattan. He became recognized as an authority on heroin addiction and its treatment.

Dr. Primm saw his first AIDS case in 1983 when examining an addict at one of his treatment centers. As tests became available for H.I.V., the virus that can lead to AIDS, he discovered that more than 40 percent of his patients were infected with the virus. The finding turned him into an outspoken advocate for clean-needle programs and robust information campaigns aimed at high-risk populations.