When I first met my client, he was sitting on the other side of a metal grate (The client’s name has been withheld because of attorney-client confidentiality). We were in the cells behind the arraignment court, where I was having a relatively normal night and he was having an objectively terrible one. He had been charged with a felony for driving while intoxicated. You don’t get charged with a felony for your first Driving While Intoxicated (DWI) charge—this was his sixth. He had a DWI infraction, two DWI misdemeanors, and two prior DWI felonies, on which he had gotten probation (the first time) and six months in jail (the second). No one had ever suggested that it might be good for him to seek treatment for alcoholism. He had never had a serious intervention and never engaged with intensive substance abuse therapy. He had no other criminal record.

States have come up with all manner of creative solutions to route people out of the prison pipeline and into alternatives—drug treatment, therapy, community service, home supervision, graffiti abatement, anger management, consequential-thinking classes, intensive interventions for alleged domestic batterers, supportive services to help individuals escape sex work—you name it, there’s a program for it.

And, yet, millions of people are still going to prison. The U.S. has 5 percent of the world’s population but almost a quarter of the world’s prisoners. It costs over $80 billion per year to maintain this level of lockdown—why is the U.S. paying a fortune to lock up people at nearly seven times the rate of China?

As it turns out, the people the U.S. is sending into these diversionary programs aren’t the ones who most need to be rescued from the prison machine—they are people who would not likely have faced serious time in the first place. And those who need this help the most have, in many cases, found themselves ruled ineligible. The country is locked in a system where prosecutors perceive incarceration as the norm and any other (perhaps more impactful, cost-effective) alternative as a gift, given only to those whose clean records merit generosity. This is where my client found himself.

He is a married father of two daughters, one his biological child and one the daughter of his wife, whom he co-parents. He had just secured a new job working in a factory after a period of unemployment, and was terrified of losing his livelihood—understandable, as he was supporting himself, his wife, and his wife’s 7-year-old daughter. My client is a dedicated father and partner, according to letters that his wife and daughter wrote to the court on his behalf. He takes his little girl to the bus in the morning, picks her up after school, and never misses her basketball games. He has an older daughter from a prior relationship to whom he is equally devoted: She wrote a letter to the judge detailing how their daily conversations span her worries about high school, life, religion, and the universe. Apart from his run-ins with the justice system, his life was going well, in stark contrast to how he started his adulthood.

My client started drinking heavily at 18. He had just finished high school and was beginning college when he went out with a cousin to a party. His cousin was speeding while he slept in the passenger seat. My client doesn’t remember the accident—all he knows is that afterwards he was in a coma, and did not awaken until months after the crash.

When he awoke, he couldn’t feel his legs. He was paralyzed from the waist down, and he was told he would never walk again. He was a teenager starting life over again as a paraplegic—acclimating to the wheelchair, and to his own feelings of hopelessness, anger, disappointment, and depression. His grades dropped and he quit school. Alcohol provided an escape, and some measure of solace.

Through years of persistence, and struggling against his body, he did the unimaginable: He regained the use of his legs. He did not, however, regain his former emotional buoyancy. He started picking up DWI charges shortly thereafter. Each time he picked up a DWI, he was told to take a five-day course through the Department of Motor Vehicles and pay a fine. He did as he was told, and his addiction continued unabated. A chronic condition, alcoholism requires long-term treatment—something that he had never undergone.

My client was released that night, but he was still facing very serious charges with the prospect of considerable prison time. He was charged with several felonies, and had no inspiring defense. As he walked out of court, though, I, as his freshly-appointed defense attorney, began speaking with him about treatment. Surely, he must be someone who had flunked out of treatment. As I questioned him about it, I realized this was not the case. He had never sought treatment on his own, and had never been mandated to serious treatment as the result of a court case. Time after time, he had come through the courtroom and not one person had offered him a way to get help.

Nationwide, the trend is to exclude people from treatment. A 2008 study observed 1.5 million arrestees at risk of drug dependence, finding only 7 percent could pass the requirements to get into treatment court programs, and only half of these were actually admitted. Only 3.8 percent of potentially treatable arrestees saw the inside of a treatment court.

Efforts to reduce the prison population that hit the news cycle are often national—easing off the throttle of the War on Drugs. In July, for example, President Obama commuted the sentences of nonviolent drug offenders in federal custody, bringing the number of commutations he’s granted in office to 89. But it overlooks the fact that criminal law is almost entirely local. Of America’s overflowing population of prisoners, only 13 percent are in federal custody—the rest are held in local jails and state prisons, governed by state systems which, constitutionally, the federal government does not alter or restrain.

Court-mandated treatment can keep a person out of prison, keep a rap sheet clean(er), and, crucially, can result in access to intensive counseling to turn a wayward life around. This is usually known as treatment court, in which a person undergoes court-mandated substance abuse treatment while a hefty term of imprisonment hangs over his or her head. Success means freedom, and maybe a reduced charge. Failure means incarceration.

Research shows that treatment courts significantly reduce crime, and the best treatment courts reduce crime by up to 40 percent. One study showed that this drop lasts up to 14 years. Moreover, these courts diminish drug and alcohol abuse, improve family relationships, raise employment rates and incomes—all positive changes reaching far beyond the rap sheet alone.

Better yet, they’re a good investment – recent numbers show that for every dollar spent on drug courts, the state saves $2.21 in reduced criminal justice costs. When drug courts take on a bigger challenge, they get a greater reward – a $3.36 return on investment for every dollar invested in treatment for serious, high-risk offenders. The savings—after considering how much money is saved by reduced hospital visits and costs of future victimization— go up to $27 for every $1 invested in treatment court. Looking at it on a per-person basis, every person treated in a drug treatment court saves the state between $3,000 and $13,000 going forward. Some research suggests that 75 percent of drug court graduates never get arrested again.

Once I offered my client the chance to start a program, he accepted eagerly. He wasn’t someone for whom treatment had failed. He jumped at the chance to try. In fact, he checked into treatment the very next day.

Statistically, he was actually a better bet than your average drug offender: A Georgia study showed that DWI offenders who go through treatment courts have a recidivism rate of around 15 percent over four years—significantly lower than the 25 percent recidivism rate for drug court participants over two years and than the 35 percent recidivism rate expected for these types of offenders.

My client had already shown willingness by starting treatment, and even the judge, after learning of his background and the fact that he had never had treatment, wanted to see him in treatment court. We were finally addressing the root of his lifelong criminal problems—but none of this was enough to get him into a diversion program. The prosecutor refused access to the program he controlled, and the treatment court judge refused my client entry to the program, citing program rules. The case lingered for over a year, as I filed documents and tried repeatedly to gain access to these programs on my client’s behalf. Again and again, I was told he was simply outside the rules, with a record too long and suffering from the wrong addiction. Rejected from the treatment court, we were sent back to the original judge.

This, as it turns out, is how we get to that 3.8 percent cited above—even though programs are available, the people who are at risk of incarceration are weeded out, for one reason or another, denied access and sent back towards the prison pipeline. For someone with a record, with a longstanding problem, ineligibility is the rule, not the exception. Without the treatment court, my client faced a term of up to three years in an upstate prison, followed by a reentry into a world in which he no longer had a job, or the ability to support his family.

That problem—seeing incarceration as the norm and any alternative as a “gift” from the prosecution—is not unique to New York. Across the country, local legislatures are creating ways out of the prison pipeline, and local officials are finding ways to stay “hard on crime” and keep the pipeline moving.

My client, for his part, continued to fight, taking advantage of what he has learned since starting treatment. When his new job in a factory resulted in his being exposed to alcohol in the product, he negotiated with his company, left that position, and found another where he would not be exposed to alcohol. Months later, when he could no longer afford to pay for treatment, he found another program that his insurance would cover. He put his entire strength into fighting his alcoholism. After being rejected by the prosecutor and rejected from the judicially-run treatment court, my client was sent back before a judge who was unafraid of making controversial decisions. The judge heard his story, and looked at the records of treatment my client had been doing for over 18 months, and made him an exceptional offer—if he pled guilty to the felony and stayed out of trouble for a year, continuing in treatment, he would close the case with a fine, a lengthy license suspension, and the installation of an ignition interlock device (a breathalyzer on the car steering wheel). Failure to meet these terms would mean prison. The judge would personally monitor my client’s progress, monthly. He wanted my client to stay employed, stable, and involved with his daughters’ lives.

When I told my colleagues about the deal my client got, they were surprised. This is far, far outside the norm. No one expected him, with his prior offenses and politically charged crime, to be able to get treatment in lieu of incarceration. But this is the way it should be: routing people away from prison as opposed to sending people whose criminality is treatable behind bars.

My client got very lucky. He had a loving wife to bail him out, a public defender with unusually good access to a social worker with treatment programs on speed dial, a job that would allow him the flexibility to go through treatment, and he landed a very brave judge. Many thousands are not so lucky. It’s impossible to fight mass incarceration, and the prosecutorial habits that underlie it, by relying only on the occasional break from a great judge.