LONDON — Some heroin addicts who got the drug under medical supervision had a better chance of kicking the habit than those who got methadone, a new study says.

In a British study of 127 people who previously failed to beat their addiction, scientists gave them either injectable heroin or methadone. After six months, those who got heroin were much less likely to continue taking the drug illegally than those who got methadone. The results were published today in the British medical journal Lancet.

Methadone has been used for decades to treat heroin addicts, but only Britain and Switzerland prescribe heroin for some addicts as part of rehabilitation.

In 2008, Britain proposed using heroin to treat some addicts on a national level, beyond the few clinics where it was available. Government officials were waiting for the results of this trial, which some say provides the necessary evidence to roll out the strategy widely.

“Treatment with supervised injectable heroin seems to be our best option,” said Roy Roberton of the department of community health sciences at Edinburgh University. He was not linked to the study.

While most addicts get methadone, heroin could be used for people in whom the heroin substitute doesn’t work.

“This is a treatment of last resort,” said John Strang of the National Addiction Center and the Institute of Psychiatry at King’s College London, the paper’s lead author. “The alternative is cheaper treatments that deliver no benefits, or prison, which is three times as expensive.”

Politics has often complicated treatment for drug addiction, as critics worry about government programs giving addicts a pure form of heroin. Similar trials were proposed in the United States, France and Belgium, but none have come to fruition.