Eating more plant-based foods and less meat is key to a healthy gut, suggests a new study. But avoiding meat or dairy products all together does not necessarily have a positive effect if it does not come with a variety of quality plant-based products, say scientists.

Researchers found that what we eat shapes the gut microbiome, the set of microorganisms that inhabit our intestine which plays a crucial role in determining a person's health, from digestion to immune response. The team analysed biological samples from more than 21,000 people in the UK, USA and Italy.

Vegans, vegetarians and omnivores were all included in the study. The findings showed that dietary pattern has a "strong influence" on the gut microbiome and on specific gut microbes that are associated with better health.

Few previous large-scale studies have examined how different diets impact the composition of gut bacteria. The new research focused in particular on the consequences of different diets on the microbiome.

The results, published in the journal Nature Microbiology, show that diet patterns shape the gut microbiome, as they not only determine the microbes necessary for digestion, but also the acquisition of microbes directly from the food itself. The research was conducted by an international team, including researchers from King's College London, coordinated by Professor Nicola Segata, of the University of Trento, Italy.

Study first author Dr Gloria Fackelmann said: "As more and more people adopt vegan and vegetarian diets, we wanted to find out how different their microbiomes are and which microorganisms are responsible for these differences." Based on the results, average vegans have the healthiest diets, followed by vegetarians and omnivores.

However, the research team said the most interesting data emerged from the study of the diversity of the gut microbiome by measuring the variety of bacteria that inhabit our intestine. Overall, there was less diversity in vegetarians and vegans than in omnivores, but scientists point out that diversity alone is not a reliable aspect to determine the health of the microbiome, as it does not take into account the quality and functionality of bacteria.

The researchers were able to see how each dietary pattern leads to a "unique" microbial signature. The microbiomes of omnivores have an increased presence of bacteria associated with meat digestion, such as Alistipes putredinis, involved in protein fermentation.

Omnivores also have more bacteria associated with inflammatory bowel disease and an increased risk of colon cancer, such as Ruminococcus torques and Bilophila wadsworthia. The microbiomes of vegans differ in the number of bacteria involved in fibre fermentation, such as several species in the Bacteroides and Firmicutes phyla, which help produce short-chain fatty acids, such as butyrate.

Those compounds have beneficial effects on gut health, as they reduce inflammation and maintain a better homeostatic balance with our metabolism and immune system. The main single difference found between vegetarians and vegans is the presence of Streptococcus thermophilus in the microbiome of vegetarians, a bacterium found mainly in dairy products and used in the production of yoghurt.

The study highlighted that it is the quality of the diet – rather than the dietary pattern itself – that influences the composition of the microbiome. People with healthier dietary patterns - whether vegan, vegetarian or omnivorous - showed a more favourable microbiome composition.

The researchers say that suggests that, regardless of the type of diet, eating more plant-based foods and less animal-based foods, especially if highly processed, can be good for gut health. Another innovative aspect of the research was the study of how bacteria transfer from food to the microbiome.

The research team found that vegans had the fewest food-associated bacteria in the microbiome, except for those derived from fruits and vegetables, which were most present. Vegetarians and omnivores showed a greater number of bacteria linked to dairy products, especially fermented ones.

Prof Segata said: "We have observed that the quantity and diversity of plant-based foods have a very positive impact on the microbiome. Avoiding meat or dairy products does not necessarily have a positive effect if it does not come with a variety of quality plant-based products."

He added: "From the point of view of the microbiome, what we can generally recommend is that it is important to eat many plant-based foods, especially those rich in fibre. And that food diversity is important."

The research is part of a larger project that aims to identify the benefits of a certain diet based on the specific microbiome of each person or group of people, known as "precision nutrition".