Manipulating memories of drug use may help reformed addicts avoid a return to a life of drug abuse, according to scientists in China.
They said memories linking "cues" - such as needles or cigarettes - and the pleasurable effects of drugs caused cravings and relapsing.
Authors of the study, published in the journal Science, "rewrote" those memories to reduce cravings.
Experts said targeting memories could become a new avenue for treatment.
Repeatedly showing people drug cues without actually giving patients the drug is a part of some therapies for addicts. It can break the link between cue and craving in the clinic. But this does not always translate to real life.
The researchers at Peking University tried to rewrite the original memory so that it would be as if the link between cue and the craving never existed.
The work relies on the idea that a memory can become malleable after it is accessed, creating a brief window during which the memory can be "rewritten".
Twenty-two heroin addicts who had not taken the drug for - on average - 11 years, took part in the study.
They were initially shown a brief video to remind them of taking drugs - opening the memory window. Ten minutes later they watched more videos and looked at pictures of heroin drug use.
Other addicts were shown an initial video of the countryside, which would not open the window.
Tests 180 days later showed that levels of cravings were lower in those treated during the 'memory window' than in the other groups. These experiments were backed up by further tests on "addicted" rats.
The authors wrote: "The [memory] procedure decreased cue-induced drug craving and perhaps could reduce the likelihood of cue-induced relapse during prolonged abstinence periods."
Dr Amy Milton, who researches memory and addiction at the University of Cambridge, said: "I'm quite excited by this research."
She said it was "such a minor" difference from current therapies which "tapped into an entirely different memory process" and the reconstruction of the original memory.
"Full clinical studies are needed, but it could be really important for treatment of addiction," she said.
Dr Milton added: "There is no theoretical reason it couldn't apply to other addictions such as alcohol. That's obviously very exciting."