WHEN an old offense caught up with 28-year-old Robert Lepolszki last year, he had a full-time job and had kicked heroin. But Frank Gulotta Jr., the Nassau County judge assigned to his case, forced him to end the only treatment that had ever worked: methadone maintenance. Judge Gulotta said that methadone does not enable a defendant “to actually rid him or herself of the addiction.” Complete abstinence programs were the only treatments his court allowed. Not long after stopping the medication, Mr. Lepolszki was dead from an overdose.

The judge’s position on methadone is common among those who administer drug courts, which are aimed at helping defendants get treatment and avoid prison. Only a third allow maintenance use of methadone or a newer medication called buprenorphine (Suboxone) and 50 percent ban maintenance outright. But they are ignoring medical evidence showing that maintenance is the best approach to opioid use disorders, which involve drugs in the same class as heroin, like OxyContin and Vicodin.

The confusion is both national and local; for example, the Manhattan Treatment Court still rejects maintenance. But right now, Gov. Andrew M. Cuomo of New York and Gov. Chris Christie of New Jersey are considering whether to sign bills that have passed their State Legislatures to force all courts to allow this treatment. They should sign the bills.

There is still widespread prejudice against maintenance, in part because many treatment providers disapprove. More than 80 percent of American addiction treatment is centered on the abstinence-based 12 steps of Alcoholics Anonymous, which means that affiliated counselors often don’t see maintenance as “real recovery.”