TIME Health For more, visit TIME Health

When it comes to carbs, your best nutrition strategy might be the oldest one in the book: moderation.

That’s according to a new study published in The Lancet Public Health, which finds that people who get about half of their total calories from carbohydrates may be at a lower risk of early death than those who follow either very high- or very low-carb diets. The researchers estimated that people who ate a moderate amount of carbohydrates at age 50 had a life expectancy of around 83, compared to 82 for high-carb eaters and 79 for low-carb eaters.

For the study, researchers analyzed data provided by nearly 15,500 middle-aged U.S. adults participating in the Atherosclerosis Risk in Communities Study. All of the participants completed a detailed diet questionnaire at the beginning of the study, then another six years later. They also provided information about their demographic background, education and income levels, smoking status, exercise habits and medical histories. The researchers then tracked them for about 25 years.

After adjusting for lifestyle factors, the researchers zeroed in on associations between carbohydrate intake and mortality. They found that mortality risk was higher for those on the high and low ends of the carb spectrum — that is, those who consumed more than 70% or less than 40% of their total calories from carbohydrates — than for those who drew between 50% and 55% of their caloric intake from carbs.

TIME Health Newsletter Get the latest health and science news, plus: burning questions and expert tips. View Sample Sign Up Now

These findings were corroborated by a review of existing studies on carbohydrate intake, involving more than 432,000 people in all.

There are a few possible explanations for this pattern, according to the study. Those on the high end of the scale may be consuming large amounts of refined carbohydrates, which don’t have much nutritional value and may have consequences for weight and overall health, the authors write. Meanwhile, at least in the U.S., those who don’t eat many carbs tend to reach for meat and dairy products instead, which may increase their risk of heart disease and death, the paper says. Those in the middle may strike a better balance.

Those tendencies point to another takeaway from the paper: If you’re going to cut carbs from your diet, think carefully about how you replace them.

Both the new research and a number of prior nutrition studies suggest that people who swap carbohydrates for plant-derived proteins and fats, such as beans, nuts and seeds, may have a lower risk of death than those who replace carbs with proteins and fats from animal sources. Similar associations have been shown for heart disease risk, the authors write. These effects suggest that it is possible to stay healthy on a low-carb diet, but “the source of food notably modifies the association between carbohydrate intake and mortality,” according to the new study.

All in all, the research suggests that eating carbs, at least in moderation, likely won’t derail your long-term health. But if you decide to slash starches, whether for weight loss or any other motivation, consider loading up on produce and plant-based proteins instead.