Rikers Island in New York City is one of the few correctional facilities in the country that offers inmates all three Food and Drug Administration-approved medications to treat opioid addiction: buprenorphine, methadone and naltrexone. (2017 photo by Spencer Platt/Getty Images)

Among my first memories as a doctor was a disheveled man, barely older than me, handcuffed to a hospital bed, vomiting a thin brown liquid into a pale pink bucket. Between retches, he sobbed and shook violently.

Driving his many medical and legal problems, I later learned, was an addiction to opioid painkillers. Driving his current misery was withdrawal.

I thought of him recently when I visited Rikers Island, where three-quarters of inmates struggle with addiction. Rikers is one of the few correctional facilities in the country that offers inmates all three Food and Drug Administration-approved medications to treat opioid addiction: buprenorphine, methadone and naltrexone.

Nationwide, less than 1 percent of jails and prisons offer medication to treat opioid addiction, and even at Rikers, inmates must be “detoxed” — not off heroin but from their medication — before they can be transferred to state prisons, which generally do not allow medication-assisted treatment for opioid use disorder.

“Providing this treatment in correctional settings requires some expertise,” said Jonathan Giftos, medical director of the opioid treatment program in the NYC jail system. “And given how rare these programs are, it can be hard for some jurisdictions to know where to look for resources or support.”

A result is that too many end up in hospitals where doctors scramble to treat overdoses that might have been prevented. Some never make it there. This failure reflects a fundamental misunderstanding of addiction, a confused view of criminal justice and a missed opportunity to save lives.

About a quarter of the 2.3 million Americans incarcerated are addicted to opioids. Most will eventually return to the community, and the period just after release is an extraordinarily dangerous time — for them. By some estimates, former inmates are more than 100 times as likely to overdose in the weeks after release compared with the general population.

“People go through horrible withdrawal during incarceration,” said Josiah Rich, a professor at Brown University and director of the Center for Prisoner Health and Human Rights. “They lose their tolerance. Then they come out and face an opioid supply that’s vastly more potent than ever before. It’s a very dangerous situation.”

Medication-assisted treatment works. It’s the ­gold-standard therapy for opioid addiction and has consistently been shown to be superior to abstinence-only therapy for preventing relapse, overdose and death. It improves behavior while in prison, reduces illicit drug use after and makes it more likely people will continue treatment over time. One study found that in the first month of incarceration, inmates on medication were 94 percent less likely to die than those without it.

The evidence is clear but largely ignored, which perpetuates a destructive cycle of addiction and incarceration that doctors, patients and correctional officers are all too familiar with.

In 1976, the Supreme Court affirmed prisoners’ right to basic health care. But despite greater recognition that addiction is an illness — not a crime — the vast majority of prisons and jails in the United States reject the use of medication to treat opioid addiction. Most states don’t offer any medications, and until recently no state provided access to all three for all inmates.

In 2016, Rhode Island launched a program to screen every person entering the correctional system for opioid addiction and offer medication-assisted treatment for those who need it. Early results are impressive. The program resulted in a 61 percent reduction in post-incarceration overdose deaths in the first year. For every 11 inmates treated, one death was prevented.

“It’s a huge effect but not a surprise,” Rich, who helped evaluate the program, told me. “We know these medicines work. It’s a matter of getting them to the people who need them.”

What’s holding other states back?

One common objection is cost. State correctional spending has grown rapidly in recent years, and some states now spend more on corrections than on higher education. At a time when health care and prison budgets are crowding out education and infrastructure, it may seem unwise to expand health care in prisons.

But this ignores a root cause of the problem. A recent analysis of the costliest individuals in the New York City jail system — 800 people accounting for $129 million in spending over six years — found almost all had substance-use problems and many committed crimes related to their addiction. Another study in New England found when the costs of criminal activity, lost productivity and other medical problems are factored in, every dollar spent on treatment is expected to save nearly $2 down the line.

A second challenge is the perception that using medication to treat opioid use disorder means substituting “one addiction for another.” This reflects a profound misunderstanding of addiction — one that hurts patients by preventing doctors from providing the treatment they need. Addiction is not dependence on a substance, but rather continued compulsive behavior despite negative consequences.

“Taking these medications to function normally is not an addiction any more than taking insulin for diabetes or an antidepressant for depression is,” said Sarah Wakeman, an addiction specialist at Massachusetts General Hospital. “This myth amplifies stigma and represents an outdated view of addiction and treatment.”

Still, the most common reason prisons say they don’t offer medication is that they prefer “drug-free detoxification.” But corrections officers express greater support for medication if they understand the evidence and if they think of addiction as a medical problem. Knowledge is power — and a path to treatment.

There are signs of progress. Last year, a federal judge in Massachusetts issued a preliminary injunction stating that denying an inmate the ability to continue his methadone violated both the Americans With Disabilities Act and the Eighth Amendment’s prohibition on “cruel and unusual punishment.”

Lawmakers in Massachusetts also passed a bill to create a pilot program to expand medication-assisted treatment in five counties. Correctional facilities in pockets across the country are planning or implementing similar programs, and New York is considering legislation that would require all jails and prisons in the state to offer medication-assisted treatment. Vermont recently passed such legislation, but many inmates are still denied access to medication.

At the heart of the issue is a question that we, as a nation, are still struggling with: What is the purpose of the criminal justice system? Punishment? Deterrence? Rehabilitation? Redemption?

Where you stand often depends on where you sit. Whether that’s outside a jail cell, inside a courtroom or beside a hospital bed, it’s time to accept that our current state fails too many too often. Sick people — even, and perhaps especially, those we’ve locked away — deserve treatment.

Dhruv Khullar is a doctor and health policy researcher at Weill Cornell Medicine and director of policy dissemination at the Physicians Foundation Center for the Study of Physician Practice and Leadership.