The health benefits of a regular run have long been known, but scientists have never understood the curious ability of exercise to boost brain power.

Now researchers think they have the answer. Neuroscientists at Cambridge University have shown that running stimulates the brain to grow fresh grey matter and it has a big impact on mental ability.

A few days of running led to the growth of hundreds of thousands of new brain cells that improved the ability to recall memories without confusing them, a skill that is crucial for learning and other cognitive tasks, researchers said.

The new brain cells appeared in a region that is linked to the formation and recollection of memories. The work reveals why jogging and other aerobic exercise can improve memory and learning, and potentially slow down the deterioration of mental ability that happens with old age.

"We know exercise can be good for healthy brain function, but this work provides us with a mechanism for the effect," said Timothy Bussey, a behavioural neuroscientist at Cambridge and a senior author on the study. The research builds on a growing body of work that suggests exercise plays a vital role in keeping the brain healthy by encouraging the growth of fresh brain cells.

Previous studies have shown that "neurogenesis" is limited in people with depression, but that their symptoms can improve if they exercise regularly. Some antidepressant drugs work by encouraging the growth of new brain cells.

Scientists are unsure why exercise triggers the growth of grey matter, but it may be linked to increased blood flow or higher levels of hormones that are released while exercising. Exercise might also reduce stress, which inhibits new brain cells through a hormone called cortisol.

The Cambridge researchers joined forces with colleagues at the US National Institute on Ageing in Maryland to investigate the effect of running.

They studied two groups of mice, one of which had unlimited access to a running wheel throughout. The other mice formed a control group. In a brief training session, the mice were put in front of a computer screen that displayed two identical squares side by side. If they nudged the one on the left with their nose they received a sugar pellet reward. If they nudged the one on the right, they got nothing.

After training the mice went on to do the memory test. The more they nudged the correct square, the better they scored. At the start of the test, the squares were 30cm apart, but got closer and closer together until they were almost touching. This part of the experiment was designed to test how good the mice were at separating two very similar memories. The human equivalent could be remembering what a person had for dinner yesterday and the day before, or where they parked on different trips to the supermarket.

The running mice clocked up an average of 15 miles (24km) a day. Their scores in the memory test were nearly twice as high as those of the control group. The greatest improvement was seen in the later stages of the experiment, when the two squares were so close they nearly touched, according to a report in the Proceedings of the National Academy of Sciences.

"At this stage of the experiment, the two memories the mice are forming of the squares are very similar. It is when they have to distinguish between the two that these new brain cells really make a difference," Bussey said.

The sedentary mice got steadily worse at the test because their memories became too similar to separate.

The scientists also tried to wrongfoot the mice by switching the square that produced a food reward. The running mice were quicker to catch on when scientists changed them around.

Brain tissue taken from the rodents showed that the running mice had grown fresh grey matter during the experiment. Tissue samples from the dentate gyrus part of the brain revealed on average 6,000 new brain cells in every cubic millimetre. The dentate gyrus is part of the hippocampus, one of the few regions of the adult brain that can grow fresh brain cells.

Running stories

"Running! If there's any activity happier, more exhilarating, more nourishing to the imagination, I can't think of what it might be. In ­running the mind flees with the body, the mysterious efflorescence of language seems to pulse in the brain, in rhythm with our feet and the swinging of our arms."

Joyce Carole Oates, American author and professor of creative writing at Princeton University:

"When I am running my mind empties itself. Everything I think while running is subordinate to the process. The thoughts that impose themselves on me while running are like light gusts of wind – they appear all of a sudden, disappear again and change nothing."

Haruki Murakami, Japanese author

"When I run, I think about everything: physics, family problems, plans for the weekend. I haven't made any big discoveries on a run, but it does give me time to think through problems. Some solutions are obvious, but they are only obvious when you are relaxed enough to find them."

Wolfgang Ketterle, Nobel prizewinning physicist, MIT

"Being a runner, to me, has made being depressed impossible. If ever I'm going through something emotional and just go outside for a run, you can rest assured that I'll come back with clarity and empowerment."

Alanis Morissette, singer-songwriter