Plant-based diets — not necessarily vegetarian or vegan, but those with plenty of fruits and vegetables — have a number of health benefits. They cut your risk of heart disease, some cancers and obesity; and according to a new study, they can lower your chance of developing type 2 diabetes. Not all plant-based diets are the same, however. When it comes to lowering your risk of diabetes, the one you choose could make a big difference.

People who go on to develop type 2 diabetes are typically over the age of 45, overweight and have a family history of diabetes. In type 2 diabetes, the body doesn’t make enough insulin or it cannot use it effectively. Insulin is what carries glucose into the cells of the body to be used as fuel. When there is a lack of insulin or insulin cannot be used effectively, glucose builds up in the bloodstream, causing diabetes to develop.

People who stuck to a diet based mostly around plant foods were 23 percent less likely to develop type 2 diabetes compared to those who ate more meat and processed foods.

Researchers at the Harvard T.H. Chan School of Public Health looked at nine published studies on the association between plant-based diets and the risk of type 2 diabetes. Analyzing the health information on over 307,000 people, including 24,000 cases of type 2 diabetes, the team assessed the difference in diabetes risk between people following two types of plant-based diets.

A healthy plant-based diet consists of fruits, vegetables, whole grains, nuts and beans with moderate amounts of animal protein. But when plant-based foods made from refined grains, starches and sugars are included, the diet becomes less healthy. To put things in perspective, an Oreo is plant-based. It is also not going to reduce your risk of type 2 diabetes.

People who stuck to a diet based mostly around plant foods were 23 percent less likely to develop type 2 diabetes compared to those who ate more meat and processed foods.

Exactly how a plant-based diet lowers your likelihood of type 2 diabetes is not yet completely clear. It is believed that plant foods improve the body’s ability to use insulin, reduce blood pressure and weight, and decrease inflammation in the body. Lack of insulin, high blood pressure, overweight and inflammation are all risk factors for diabetes.

If you have a family history of diabetes or have seen your fasting blood sugar number starting to creep upward, following a healthy plant-based diet can reduce your risk of developing type 2 diabetes. Concentrate your food choices on healthy and unprocessed plant foods — fruits, vegetables, whole grains, nuts and beans — with moderate amounts of animal protein.

And skip the Oreos.

The study was published in JAMA Internal Medicine.