If a mother puts on too much weight during pregnancy, it increases the chances that her child will be overweight at age 12, new research shows.

Medicine has long focused on the effects of malnutrition during pregnancy. Expectant mothers are encouraged to take vitamin supplements to ensure that their child receives all the crucial nutrients they need. But with America’s rising obesity epidemic, it’s time to examine the effects of another, seemingly unrelated problem: overnutrition.

To learn more, Dr. David Ludwig at the Boston Children’s Hospital partnered with Dr. Heather Rouse from the Arkansas Center for Health Improvement and Dr. Janet Currie at Princeton University. They used a set of data gathered in Arkansas that included 42,133 women and their 91,045 children. The team matched hospital records of women’s weight gain during pregnancy with body mass index (BMI) data gathered from their children years later.

By examining women with more than one child and comparing the siblings’ outcomes, they were able to control for both genetics and upbringing. The researchers speculated that two children with the same parents, growing up in the same home and eating the same food, might have different risks for obesity based on how much weight their mother gained during each pregnancy.

Learn More About Nutritional Needs During Pregnancy

The study results confirmed what Ludwig had already seen in animal studies: a mother’s overnutrition during pregnancy made her children more likely to be overweight or obese as middle-schoolers, independent of genetics and diet.

“This distinction is important,” explained Ludwig, director of the New Balance Foundation Obesity Prevention Center at Boston Children’s Hospital, in an interview with Healthline. “If maternal overnutrition has an independent effect on childhood body weight, the implications would be major: obesity could accelerate through successive generations, unless this vicious cycle is interrupted.”

When an expectant mother overeats, her bloodstream becomes saturated with surplus calories, which reach her child along with all the nutrients the child needs. Although the exact mechanism is still unknown, nine months of exposure to an overly-rich diet programs the child’s body to retain calories as an adult, making him or her more likely to be overweight.

Get the Facts: When Is Obesity Genetic?

Ludwig thinks this might be one factor contributing to the obesity epidemic. “We found that pregnancy weight gain was strongly associated with childhood BMI,” he said. “The child of a woman with high pregnancy weight gain had an eight percent increased risk of obesity at an average age of 12 years. Though relatively small on an individual basis, the effects we found could explain several hundred thousand cases of childhood obesity globally each year.”

This finding offers hope for overweight mothers-to-be who want to do everything they can to protect their children from obesity. Due to a number of metabolic and hormonal factors, losing weight and keeping it off can be difficult for many women, especially over the course of years. However, Ludwig’s research means that simply trying to maintain weight control for the duration of your pregnancy could have a lifelong protective effect on your child.

“Weight management can be difficult for many people over the long-term,” Ludwig explained. “This study suggests that avoiding excessive weight gain during pregnancy—just 9 months—can have long-term benefits for the next generation. Since pregnant women are often especially motivated to make behavioral changes for the benefit of their child, these findings suggest that the best time to begin childhood obesity prevention is prior to birth.”

Photo of Dr. David Ludwig, courtesy of Boston Children’s Hospital

Read More: Obesity During Pregnancy Increases the Risk of Premature Birth