Eating a plant-based diet is good for your health — but some plant-based diets are better than others, a new study that spanned nearly three decades finds.

Most previous research that has looked at the health benefits of plant-based eating has defined a plant-based diet simply as one that leaves out all or most animal-based foods, according to the study. And that research, along with the new study, has shown that eating less meat — and more fruits, veggies and whole grains, for example — can help reduce a person's risk of heart disease.

But the new study found that eating less meat, but also eating more refined carbohydrates, and sticking with the sugar-sweetened beverages, can have the opposite effect. [7 Tips for Moving Toward a More Plant-Based Diet]

In the study, published today (July 17) in the Journal of the American College of Cardiology, the researchers first described three possible versions of a plant-based diet, then looked to see how well people's actual diets lined up with each version, and how their health fared over time. The first version focused on eating any plant-based foods and simply reducing animal-food intake. The second focused on eating healthy plant-based foods, such as whole grains, fruits and vegetables; and the third diet was focused on unhealthy plant-based foods, such as refined carbs, potatoes and sugary drinks.

In the study, the researchers analyzed diet data from more than 166,000 women who were participating in the Nurses' Health Study and the Nurses' Health Study II, and more than 43,000 men from the Health Professionals Follow-Up Study. All three are long-running studies that gather information on people's health, diet and lifestyle. The new analysis was led by Ambika Satija, a postdoctoral fellow at the Harvard School of Public Health.

During the follow-up period, which lasted for up to 28 years, more than 8,600 people developed heart disease.

The people whose diets were closest to the general plant-based diet were 8 percent less likely to develop heart disease than those whose diets were least similar, the researchers found.

And when people's diets were most similar to the healthy plant-based diet, the heart-health benefit was greater: These individuals were 25 percent less likely to develop heart disease, compared with those whose diets were least like the healthy plant-based diet, the researchers found.

The unhealthy plant-based diet, however, had the opposite effect: Those whose diets matched this pattern the most had a 32 percent increased risk of heart disease, compared to people whose diets differed the most from this way of eating.

Simply put, the findings suggest that it's best to eat a diet that not only emphasizes plant-based foods, such as whole grains, fruits, vegetables and nuts, but also one that avoids unhealthy plant-based foods such as sweets, refined carbohydrates and sugary drinks.

The researchers noted that the study had limitations; for example, because the data on people's diets was self-reported, it may not have been completely accurate.

Originally published on Live Science.