Being physically fit may sharpen the memory and lower our risk of dementia, even if we do not start exercising until we are middle-aged or older, according to two stirring new studies of the interplay between exercise, aging, aerobic fitness and forgetting. But both studies, while underscoring the importance of activity for brain health, also suggest that some types of exercise may be better than others at safeguarding and even enhancing our memory.

The scientific evidence linking exercise, fitness and brain health is already hefty and growing. Multiple studies have found that people with relatively high levels of endurance, whatever their age, tend to perform better on tests of thinking and memory than people who are out of shape. Other studies associate better fitness with less risk for developing Alzheimer’s disease.

But many of these studies have been one-time snapshots of people’s lives and did not delve into whether and how changing fitness over time might alter people’s memory skills or dementia risk. They did not, in other words, tell us whether, by midlife or retirement age, it might be too late to improve our brain health with exercise.

So, for the first of the new studies, which was published this month in The Lancet Public Health, researchers at the Norwegian University of Science and Technology in Trondheim, Norway, helpfully decided to look into that very issue, taking advantage of the reams of health data available on average Norwegians.

They began by turning to records from a large-scale health study that had enrolled almost every adult resident in the region around Trondheim beginning in the 1980s. The participants completed health and medical testing twice, about 10 years apart, that included estimates of their aerobic fitness.

The researchers pulled records now for more than 30,000 of these middle-aged participants and categorized them by their fitness and how it changed over the decade. Some had started and stayed out of shape; they remained in the lowest 20 percent of aerobic fitness for the whole 10 years. Others moved into or out of that group. And the fittest few began outside of the bottom 20 percent and remained outside that group for all 10 years.

The researchers then checked records from nursing homes and specialized memory clinics to see which participants developed dementia during a 20-year follow-up period and if fitness affected their risk for the disease.

They found that it did. People who were fit throughout the study period proved to be almost 50 percent less likely to develop dementia than the least-fit men and women. Perhaps more encouraging, those men and women who had entered middle age out of shape but then gained fitness showed the same substantial reduction in their subsequent risk for dementia.

“We expected some effect” on brain health from having or adding fitness, says Ulrik Wisloff, the director of the Cardiac Exercise Research Group at the Norwegian University of Science and Technology and senior author of the new study. “But the effect was larger than we thought.” (For those wondering about their current state of fitness, the university offers a free, online fitness calculator, available at https://www.ntnu.edu/cerg/vo2max.)

His group’s study did not examine, though, how those men and women who raised their fitness managed that feat. Which makes the other new study about exercise and memory a valuable complement.

In that experiment, which was published recently in Applied Physiology, Nutrition, and Metabolism, researchers at McMaster University in Ontario, Canada, tested what types of exercise might be most effective at increasing both aerobic fitness and memory performance in healthy, older adults.

They began by recruiting 64 sedentary men and women aged 60 or older and measuring their fitness and thinking skills. The researchers focused, in particular, on the participants’ ability to differentiate similar memories, such as where in the same parking lot someone left his or her car yesterday versus today. This kind of recall often declines with age, and a poor performance can mark the start of mild cognitive impairment and, in some cases, dementia.

After testing, the researchers randomly assigned the volunteers to visit the lab and stretch, as a control group, or start exercising. One of the exercise groups walked moderately and steadily on treadmills three times a week for about 50 minutes. The others began interval walking, during which their treadmills’ incline was cranked high for four minutes so that their heart rates rose to about 90 percent of each person’s maximum, followed by three minutes of easy walking, and three more rounds of the incline intervals.

After 12 weeks, the volunteers repeated their fitness and cognitive tests, with striking results. Only the interval walkers now showed significant improvements in both physical endurance and memory performance, and their gains were linked. The more fit someone became, the more his or her memory sharpened.

In essence, the findings suggest that “it is not too late” for middle-aged or older people to start exercising and protect their memories, says Jennifer Heisz, an associate professor at McMaster University who oversaw the new study.

But the exercise probably needs to be at least somewhat intense, so that it raises heart rates and gooses fitness. “I tell people to add in some hills when they go for a walk,” she says, “or pick up the pace between street lamps.”

Dr. Wisloff would agree. For endurance and brain health, he says, try regularly to “exercise with an intensity so that you get out of breath.”