Bones do a lot more than give the body structure. They anchor muscles, protect organs and store calcium. Strong bones are built during childhood and adolescence. In fact, by the time they are 30, most people have built all the bone mass they will ever have. In adulthood, protecting bone mass becomes the goal.

When it comes to improving and preserving bone mass, one of the big questions has been, which helps more — a healthy diet or regular exercise? Both have been proven to increase bone mass, but University of Michigan researchers were interested in seeing which benefited bones the most. The team compared a diet supplemented with calcium and phosphorus with exercise to see which had the greatest impact on bone mass in mice.

By the age of 30 most people have built all the bone mass they will ever have. In adulthood, protecting bone mass is the goal.

The results surprised even the researchers. Nutrition had the larger impact. Even when exercise stopped, the mice retained their bone strength as long as they ate a diet supplemented with calcium and phosphorus.

“This was done in mice, but if you think about the progression to humans, diet is easier for someone to carry on as they get older and stop exercising, rather than the continuation of exercise itself,” researcher, David Kohn, explained in a statement.

Another surprise was that diet alone helped maintain bone mass and strength with aging, even with no exercise. Researchers had expected that diet combined with exercise would result in increased bone strength, but that wasn’t what the study found. Still, seniors will want to focus on weight-bearing exercise to keep bones strong.

What made this study different from others is the use of phosphorus supplements in addition to calcium. Other studies have only used calcium.

If you want healthy bones throughout life, you need to start working on it while you are young. Maximizing the amount of bone mass you achieve puts you in a better position to keep your bones strong as they age.

For parents, this means you need to pay attention to the foods you give your children and the dietary habits you teach them. Make sure your diet provides you and your children with adequate calcium and phosphorus. Dairy foods contain the most readily-available form of calcium for the body, but green vegetables, fish with soft edible bones, such as mackerel, canned salmon or sardines, and Brazil nuts and almonds are also good sources of calcium. Dairy foods are also the best source of phosphorus, along with fish, meat, nuts, beans and whole grains.

This was an animal study, and the results of animal studies don’t always translate to humans, so don’t start taking calcium and phosphorus supplements without first speaking to your doctor.

The study is published in PLOS ONE.