There’s no question that nutrition studies tend to whipsaw—a lot—between telling you something is good for your health and warning against it.
In recent months, the news over dietary fat certainly fell into this category. While for decades doctors warned us about the dangers of too much saturated fat—the kind found in red meat, dairy and fried foods—some studies seemed to suggest that people who cut back on these verboten foods didn’t have any lower risk of heart problems than those who didn’t. That prompted advice to stick to butter over margarine, and not to worry too much about fat.
MORE: Ending the War on Fat
More from TIME
Now, a study published in the Journal of the American College of Cardiology finds that too much saturated fat is indeed harmful to the heart, but it also provides an explanation for the earlier confusing study results as well. If you cut out calories from saturated fat, the kinds of calories you replace them with can be just as detrimental.
Led by Dr. Frank Hu from the Harvard T.H. Chan School of Public Health, the scientists analyzed data from two large populations: 84,628 women in the Nurses’ Health Study and 42,908 men in the Health Professionals Follow Up Study who were followed from the 1980s to 2010. During the nearly three decades of follow up, the participants answered questions about the food they ate and provided information about any heart-related events they experienced.
Overall, people who ate more saturated fat showed a higher risk of heart disease compared to those who ate less. Also, people who ate more polyunsaturated fats (the healthier fats in vegetable oils) and more whole grain carbohydrates lowered their risk of heart disease compared to people who included less of these nutrients in their diet.
MORE: Trans Fat Bans Reduce Heart Disease Deaths: Study
Because of the detailed nature of the food questions, the researchers could study in even more depth the patterns of diet changes among the volunteers. For example, as people dropped the number of calories they ate each day from saturated fat, Hu and his team could see that the participants replaced these fats with carbohydrates: particularly refined carbohydrates that are more easily transferred into fat. That contributed to a heart disease risk that was almost equal to that from saturated fats. That could explain why previous studies had found little benefit to reducing saturated fat, since most people tend to replace them with equally unhealthy carbohydrates.
MORE: Does a Low-Carb Diet Really Beat Low-Fat?
For people who replaced the saturated with better-for-you whole grains, however, the story was different. They showed a lower risk of heart disease compared to those who didn’t make the switch. Those who replaced 5% of their daily energy intake from saturated fat with healthier fats or whole grains lowered their risk of heart events by anywhere from 9% to 25%. But there was no change in heart disease risk for those who replaced 5% of saturated fat with refined carbohydrates, like starches. “The risk doesn’t increase, but it also doesn’t decrease, so you’re not doing yourself any favors,” says Adela Hruby, a research fellow in the department of nutrition and co-lead author of the paper. “So you might as well just keep the butter there.”
MORE: This Is the Worst Kind of Fat for Your Heart
The lesson is not to load up on saturated fat but to pay attention to what you’re replacing it with if you’re making changes in your diet. Cutting back on animal-based fats is a good move for your heart, but if you’re switching to carbohydrate-dense foods like starches, pastas and things made from refined flour, then you’re doing just as much harm to your heart as eating saturated fat.
To truly help your heart, it makes sense to lower the amount of saturated fat you eat and to replace it with healthier fats, such as olive oil and vegetable oils, and whole grain carbohydrates. “We know that people don’t just drop 10% of their calories from whatever and not replace them with other things,” says Hruby. “What they are adding in to replace what they’re not eating is really important. What this study shows is that nutrient replacement matters.”