Scientists have pinpointed a part of the brain that processes memories of addictive behaviour.
The rats were given cocaine
It was already known that events such as walking through an old neighbourhood or hearing a certain song, could lead addicts to relapse.
A study of how rats' remembered triggers for taking drugs was published in the Journal of Neuroscience.
US researchers say the discovery could help doctors devise new therapies for addition and ways of helping patients.
Researchers from Rutgers, the State University of New Jersey, looked at nerve cells in rats' brains in an area called the nucleus accumbens, which is known to be involved in the addictive effect of drugs.
In laboratory experiments, scientists set up a device where rats could self-administer cocaine, a highly addictive drug.
The researchers say this provides a good model for human addiction.
Cocaine was dispensed to the rats when they pressed a lever.
Microelectrodes that recorded the activity of single neurons were used to monitor nerve cells in a part of the nucleus accumbens known as the shell.
When the rats animals self-administered the cocaine, a tone was sounded and they came to associate the tone with the drug.
If an animal pressed the lever when there was no tone, no cocaine was dispensed.
At the end of three weeks, the rats had learned to press the lever when they heard the tone.
The researchers then removed both the drug and the lever.
'Slow to forget'
The lever - but no cocaine - was returned to the rats' cage after a month.
It was virtually ignored by the animals until the tone was reintroduced, indicating they recognised the tone's significance.
Brain activity recordings showed that accumbens shell neurons responded almost instantaneously when the tone was sounded.
These cells had not responded to the tone before conditioning.
When the rats realised no cocaine was being dispensed when they heard the tone, they stopped pressing the lever.
But the researchers still identified activity in the accumbens nerve cells even after the rats stopped pressing the lever.
Mark West, a psychology professor, who led the research, said the brain was slow to forget the stimuli and memories persist even after a relatively long period of drug abstinence.
He said this may partially explain why it can be hard to tackle drug addiction.
Professor West said: "We've identified a part of the brain that appears to process these memories.
"This might be one of the brain areas that a very skilled pharmacological approach could target."
He added: "The neural mechanisms of learning are still not understood. This is what we were investigating here - neural mechanisms in one part of a brain circuit that participate in creating memories of these environmental stimuli.
"As medical science seeks to develop chemicals that alleviate drug craving, our data may help scientists or clinicians know what part of the brain to target.
"With cocaine, we haven't yet discovered a magic bullet that can go in and just cure the problem."
Dr David Ball, a researcher with Action on Addiction, told BBC News Online: "This work is very valuable. It demonstrates why addictions are so hard to treat.
"If parts of the brain are still primed to the memories of drug-taking behaviour and have not reset themselves, then it is very difficult to avoid a relapse."
He added: "Human studies are needed to fully understand the role of cues in triggering drug use.
"This could lead to improved treatment in the future, using drugs which target the areas of the brain involved, or the exposure theory which weans patients off drugs in safe environments."