Offering medication to treat opioid addiction in jails and prisons reduces overdose deaths, a new study finds.

Most jails and prisons in the United States discontinue medications for opioid use disorder when a person is incarcerated, even if they have been stable on the medication, according to the researchers from Boston Medical Center. Jails and prisons do not usually initiate treatment with opioid addiction medication for incarcerated individuals before their release. Patients often suffer withdrawal symptoms while incarcerated, and the post incarceration period is a time of very high-risk for overdose death, the researchers said.

The study included 30,000 incarcerated people with opioid use disorder, HealthDay reports. The researchers found offering no addiction medication was associated with almost 41,000 treatment starts over a five-year period, and 1,259 overdose deaths after five years.

Offering naltrexone at release led to more than 10,400 additional treatment starts, and 40 fewer overdose deaths over five years. In comparison, offering buprenorphine, methadone, and naltrexone at intake led to almost 12,000 additional treatment starts compared to offering no treatment, and 83 fewer overdose deaths.

“We hope our study supports policy change at the state and federal level, requiring treating opioid use disorder with medications among people who are incarcerated,” study author Dr. Avik Chatterjee said in a news release.