Physical activity is good for our brains. A wealth of science supports that idea. But precisely how exercise alters and improves the brain remains somewhat mysterious.

A new study with mice fills in one piece of that puzzle. It shows that, in rodents at least, strenuous exercise seems to beneficially change how certain genes work inside the brain. Though the study was in mice, and not people, there are encouraging hints that similar things may be going on inside our own skulls.

For years, scientists have known that the brains of animals and people who regularly exercise are different than the brains of those who are sedentary. Experiments in animals show that, for instance, exercise induces the creation of many new cells in the hippocampus, which is a part of the brain essential for memory and learning, and also improves the survival of those fragile, newborn neurons.

Researchers believe that exercise performs these feats at least in part by goosing the body’s production of a substance called brain-derived neurotrophic factor, or B.D.N.F., which is a protein that scientists sometimes refer to as “Miracle-Gro” for the brain. B.D.N.F. helps neurons to grow and remain vigorous and also strengthens the synapses that connect neurons, allowing the brain to function better. Low levels of B.D.N.F. have been associated with cognitive decline in both people and animals. Exercise increases levels of B.D.N.F. in brain tissue.

But scientists have not understood just what it is about exercise that prompts the brain to start pumping out additional B.D.N.F.

So for the new study, which was published this month in the journal eLIFE, researchers with New York University’s Langone Medical Center and other institutions decided to microscopically examine and reverse engineer the steps that lead to a surge in B.D.N.F. after exercise.

Ketones prove to be good for brain health

Perhaps most remarkably, the researchers also found a particular substance in the runners’ brains that fended off the action of these obstructionist molecules. The runners’ brains contained high levels of ketones, which are a byproduct of the breakdown of fat. During strenuous exercise, the body relies in part on fat for fuel and winds up creating ketones, some of which migrate to the brain. (They are tiny enough to cross the blood-brain barrier.) The brain uses these ketones for fuel when blood sugar levels grow low.

But it appears that ketones also cause the molecules that hinder the B.D.N.F. gene to loosen their grip, as the scientists realized when they experimentally added ketones to brain tissue from some of the mice. Afterward, their B.D.N.F. genes were not blocked by nearly as many of the bothersome molecules, and those genes could get on with the job of making B.D.N.F.