“YOU got to be selfish. You got to do what’s best for you,” says Craig Hannah, a judge in Buffalo, New York, to the young man standing before the bench. “Yeah, I know,” replies Patrick Bruno, “It’s so hard.” Mr Hannah runs the country’s first opioid court. Mr Bruno, who has appeared before him regularly since the court opened in May, is struggling to stay away from friends who are still getting high. “They’re not helping,” the judge says. “I want you to show me you’re serious.”

Buffalo’s experiment began after Jeffrey Smith, who heads the district’s treatment courts, noticed that many of those arrested while high on opiates did not live long enough to make their court dates. The city has a history of developing such specialist courts. In the 1990s it was an early adopter of drug courts, which try to mentor defendants through rehabilitation rather than sending them to prison. Later it introduced mental-health courts. It created the first specialised court to try troubled military veterans, which has since been copied all over the country. It also launched the first human-trafficking court. Such specialist courts often arise when a judge tires of seeing the same defendants cycle endlessly through courts and prison.

Defendants appear before Mr Hannah in court within a day of their arrest and are then sent to residential rehabilitation clinics. After a month of treatment, they must appear in front of Mr Hannah for 30 consecutive days, be drug-tested regularly, agree to 8pm curfews, call in their whereabouts every evening and continue outpatient care. Many fall off the wagon, but second, third and fourth chances are given. Cases are put on hold until defendants complete the programme. The goal is to keep everyone alive, rather than to fill jails with addicts and morgues with corpses.

“I look at it as parenting,” says Mr Hannah. He dishes out compliments and praises defendants for staying clean. He notices when one gets a haircut and is delighted to learn that another has dumped her unsupportive boyfriend. He knows when he is being spun a line: Mr Hannah threatens to send people who do not show up to court, or who fail to ring in, to jail and issues arrest warrants for those who disappear. This mixture of kindness and toughness is informed by the judge’s own problems with cocaine addiction when he was young. His court has seen 143 defendants so far. Not one has fatally overdosed.

Replicating the conditions that produced Buffalo’s opioid court elsewhere will be hard. The co-operation between police, judges, district attorneys, as well as public and private defenders, that such a court needs to get going is rare. Mr Smith reckons Buffalo’s success has something to do with snow. The city gets about 8 feet of it every winter, he points out, and everyone pitches in to shovel and plough.

Meanwhile, the federal government is flailing around. President Donald Trump created an opioid commission, which found that in 2015 enough opioids were prescribed to medicate every American for three weeks. In July the commission recommended declaring a national emergency, which would free up money for the problem, but that has not happened yet. The president nominated Tom Marino, a Pennsylvania congressman, to be his director of drug-control policy. Then a report by the Washington Post and “60 Minutes” showed that he had sponsored a bill backed by distributors of pain pills that made it harder for the Drug Enforcement Agency to prosecute them. Mr Marino has withdrawn his name from consideration for the job.