Despite differences in macronutrient composition among the dizzying array of diets these days, the specific types of food that someone chooses appears to be the deciding factor in whether a certain eating style is indeed a healthy choice.

Gleaning data from 37,233 American adults involved in the National Health and Nutrition Examination Survey (NHANES), researchers working at the Harvard T.H. Chan School of Public Health found no differences in the overall risk of death (during the study) between people following a low-carbohydrate or low-fat diet; however, healthy versions of each regimen were linked to lower mortality, whereas deaths (a total of 4,866 occurred over 297,768 person-years) increased at statistically equal rates for both diets when people made unhealthy food choices.

Mortality risk decreased by 9% for the healthy low-carb diet and 11% for the healthy low-fat diet, but this risk level increased by 7% and 6% for unhealthy low-carb and unhealthy low-fat diets, respectively. Examples of unhealthy carbohydrates identified by the study authors included refined grains and packaged foods with added sugars, whereas healthier options included whole grains, vegetables and whole fruits. For low-carbohydrate diets, foods higher in unsaturated fat were given a healthier score than items richer in saturated fat.

While the definitions of “low-fat” and “low-carb” were quite loose and not necessarily as stringent as certain trending diet regimens, the takeaway from this JAMA Internal Medicine study is that the health benefits of any particular diet—be it paleo, vegan or keto—may depend greatly on the nutritional quality of the foods an individual typically consumes.

See also: Low-Fat Versus Low-Carb: It’s A Draw