Coffee may help to prevent memory loss in old age, claim scientists, who have discovered that caffeine alters electrical activity in the brain.

Boosting gamma rhythms, produced by the synchronised firing of nerve cells 40 times a second, aids memory and learning. It involves a brain chemical called adenosine – present in especially high levels in the elderly.

When adenosine binds to a molecular receptor on brain cells called A1, it reduces the activity of neurons and lessens the strength of gamma rhythms. Synchronised nerve cell activity plays a key role in information processing, which is why gamma rhythms increase when people attempt to solve complex mental problems.

Caffeine prevents adenosine binding to the A1 receptor, thereby blocking its effects and boosting gamma rhythms.

Dr Martin Vreugdenhil, of the University of Birmingham, whose team made the discovery, said: "Some people can’t get started without a cup of coffee; others need a shot of Red Bull to keep going. Caffeine is by far the most widely used psychoactive drug.

"Research has shown that it increases alertness, cortical activity and speeds up information processing."

The research, which involved testing caffeine on mouse neurons in a laboratory, was presented at the annual meeting of the Physiological Society at University College London last week.

Dr Vreugdenhil said drinking coffee regularly could increase gamma rhythms up to threefold because of the way caffeine was concentrated in the brain.

He pointed out, however, that too much coffee could have adverse effects: "Sleep problems and effects on the heart and blood system caused by caffeine are good reasons to go for decaf and for scientists to attempt to separate the beneficial effects from the side-effects."