Eating more fruits — particularly berries, apples and pears — and nonstarchy vegetables, like soybeans and cauliflower, may help you lose weight over the long term, a new study suggests.

However, adding starchy vegetables like peas, potatoes and corn to your diet may not be as good for your waistline: People who increased their consumption of these vegetables gained weight over time, the study found.

"Unfortunately, most Americans have inadequate fruit and vegetable intake," but when they do eat these foods, they may be consuming too much fruit juice and potatoes, the researchers said. Therefore, "nutritional guidelines ought to emphasize individual or subgroups of specific fruits and vegetables that maximize the potential for weight maintenance and disease prevention," they said.

In the study, researchers at the Harvard T. H. Chan School of Public Health in Boston analyzed information from more than 130,000 U.S. adults who were followed for more than two decades as part of several large, long-running studies of health professionals. Every four years, the participants were mailed a survey and kept track of the foods they ate each day for a week. They also reported their weight every two years.

Overall, the participants who increased their fruit and vegetable consumption over a four-year period tended to lose weight. For each additional serving of fruit that the participants ate weekly, they lost about half a pound (0.2 kilograms), and for each additional serving of vegetables weekly, they lost about a quarter of a pound (0.1 kg). [6 Easy Ways to Eat More Fruits and Vegetables]

It's possible that the reason for the weight loss is that people eat fruits and vegetables instead of eating other, less healthy foods. Another analysis by the study found that replacing 5 percent of calories from other foods with 5 percent of calories from fruits and vegetables over four years was linked with about a pound of weight loss.

The fruits with the biggest impact on weight loss included berries, apples and pears: Each serving of these fruits added over a four-year period was linked with about 1 lb. (0.4 kg) of weight loss.

Cauliflower and soy-based products like tofu were also good for the waistline: Each additional serving of these foods was linked with about 2 lbs. (0.9 kg) of weight loss.

However, several starchy vegetables were linked with weight gain. For each additional serving of corn over a four-year period, participants gained about 2 lbs.; for each additional serving of peas, they gained about a pound; and for each additional serving of baked, boiled or mashed potatoes, they gained about 0.75 lbs. (0.3 kg).

Although starchy vegetables are nutrient-rich foods — they contain potassium, vitamin C, vitamin B6, iron, fiber and protein — they may cause greater increases in blood sugar levels than other vegetables, which could explain why they were linked with weight gain, the researchers said. (Spikes in blood sugar may increase hunger and cause people to eat more.)

On the other hand, fruits and vegetables with more fiber may increase feelings of fullness, and lead people to eat less overall, the researchers said. The link between greater fruit and vegetable consumption and less weight gain held even after the researchers took into account factors that could affect weight, such as people's physical activity levels, the amount of sleep they got and whether they smoked. However, it's possible that people who ate healthy foods also practiced other healthy behaviors that they study did not account for.

In addition, because the study included mainly white adults with a high level of education, the findings may not apply to other populations, the researchers said.

Still, the findings "support benefits of increased fruit and vegetable consumption for preventing long-term weight gain, and provide further food-specific guidance for the prevention of obesity," they said.

Copyright 2015 LiveScience, a Purch company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.