How much protein you eat—and where that protein comes from—may affect your lifespan, suggests research published today in JAMA Internal Medicine. The new analysis, conducted at Massachusetts General Hospital, found that people who ate a lot of animal protein had a higher-than-average risk of dying over the next few decades, especially if they favored processed red meat over fish or poultry. Those who ate more plant-based protein, on the other hand, had a lower-than-average risk of death.

The new research included data from two prior long-term studies, which collectively had more than 170,000 total participants. The people in these studies were tracked for 26 to 30 years and also asked to answer questions about their health and eating habits every few years. On average, they received about 14% of their daily calories from animal protein, and 4% from plant-based protein. During this time, more than 36,000 of them died.

After adjusting the results for lifestyle and other risk factors, the researchers found that those who ate the most animal protein—defined as any type of meat, eggs, or dairy—had a slightly increased risk of death. People who ate less animal protein and consumed more protein from plant-based sources—breads, cereals, pastas, beans, nuts, and legumes—were the least likely to die during the study.

RELATED: 14 Best Vegan and Vegetarian Protein Sources

The news isn’t all bad for meat lovers, though. The increased risk of death only applied to people who had at least one "unhealthy lifestyle" factor, such as being a heavy drinker, a smoker, or overweight or obese, or getting very little exercise. For participants who led overall healthy lifestyles, the link disappeared.

The study authors suspect that, in addition to lifestyle factors, the specific types of meat consumed also played a role.

"While we expected we might find the associations to be weaker in the healthy lifestyle group, we did not expect them to completely disappear," said Mingyang Song, MD, a research fellow in the Massachusetts General Hospital Clinical and Translational Epidemiology Unit and Division of Gastroenterology, in a press release. "But when we looked deeper into the data, we found that—at similar levels of animal protein intake—those in the unhealthy lifestyle group consumed more red meats, eggs, and high-fat dairy, while the healthy lifestyle group consumed more fish and poultry.”

Indeed, when they broke down the study results into specific types of animal protein, they found that the link between animal protein and increased risk of death applied primarily to people who ate lots of processed and unprocessed red meats (including beef and pork), and not to fish or poultry.

RELATED: The Secret to Sticking to a Healthy Diet Couldn't Be Simpler

While this was by far the largest study to compare the effects of different types of protein, its findings aren’t particularly surprising. Experts have long recommended plant-based proteins, poultry, and fish over red meat, which tends to be high in saturated fat and cholesterol. Health contributing nutrition editor Cynthia Sass, RD, notes that people who eat less meat tend to weigh less and have lower rates of heart disease and type 2 diabetes. And you don’t have to be a full-on vegetarian to adopt some veggie-friendly habits, she explained in a post on Health.com last year. Eating more protein-packed pulses (think beans, peas, and lentils) can also make a difference.

In that sense, this new study adds more weight to what Sass and other nutrition experts have been saying for years.

“Our findings suggest that people should consider eating more plant proteins than animal proteins,” said Dr. Song, “and when they do choose among sources of animal protein, fish and chicken are probably better choices."