Babies born by Caesarean section have dramatically different gut bacteria to those born vaginally, according to the largest study in the field.

The UK scientists say these early encounters with microbes may act as a "thermostat" for the immune system.

And they may help explain why Caesarean babies are more likely to have some health problems later in life.

The researchers stress women should not swab babies with their vaginal fluids - known as "vaginal seeding".

How important are gut bacteria?

Our bodies are not entirely human - instead we are an ecosystem with around half our body's cells made up of microbes such as bacteria, viruses and fungi.

Most of them live in our gut and are collectively known as our microbiome.

The microbiome is linked to diseases including allergy, obesity, inflammatory bowel disease, Parkinson's, whether cancer drugs work and even depression and autism.

This study - by Wellcome Sanger Institute, UCL, and the University of Birmingham - assessed how the microbiome forms when we leave our mother's sterile womb and enter a world full of bugs.

Regular samples were taken from the nappies of nearly 600 babies for the first month of life, and some provided faecal samples for up to a year.

The study, published in the journal Nature, showed vaginally born babies got most of their early bacteria from their mother.

But Caesarean-section babies had high levels of hospital bugs such as Klebsiella and Pseudomonas.

"What surprised me and scared me was the amount of healthcare bugs showing up in these children," Dr Trevor Lawley, from the Wellcome Sanger Institute, told the BBC.

"It could be 30% of their total microbiome.

"But what excites me is we have an amazing body of data now that we can build on, to think about how to properly establish the human ecosystem, starting at birth."

The microbiome

You're more microbe than human - if you count all the cells in your body, only 43% are human

The rest is our microbiome and includes bacteria, viruses, fungi and single-celled archaea

The human genome - the full set of genetic instructions for a human being - is made up of 20,000 instructions called genes

But add all the genes in our microbiome together and the figure comes out at between two million and 20 million microbial genes

Our microbiome is also known as our "second genome"

Does this affect the baby's health?

It is already known that children born by Caesarean are at higher risk of some disorders such as type 1 diabetes, allergies and asthma.

An errant immune system - the body's defence against infection - can play a role in all of them.

Differences between vaginally-delivered and Caesarean babies faded over time and largely evened out by their first birthdays.

So a leading idea in the field is that the bugs which first colonise us are crucially important and help train our immune system to tell friend from foe.

"The hypothesis is that the moment of birth might be a sort of "thermostat" moment, which sets the immune system for future life," says researcher Dr Nigel Field from UCL.

The study - the Baby Biome Project - will continue to follow the babies through childhood, and should provide more clarity.

Image caption Most of our microbiome resides inside our guts

How else can you alter a baby's microbiome?

The method of birth had the biggest impact on the babies' microbiomes, but antibiotics and whether or not mothers breastfed their babies, also altered the fledgling relationship between our microbial and human halves.

Previous research in this field has led to a trend for "vaginal seeding" in which mothers rub vaginal fluid on the face and mouth of their babies after a Caesarean.

However, the study showed that even vaginally-born babies were getting no more vaginal bacteria than Caesarean babies.

Instead, the bacteria passed from mother to baby were coming from contact with the mother's faeces during labour.

The researchers said vaginal seeding risked exposing babies to dangerous Group B strep.

In the future it might be possible to give Caesarean babies a cocktail of good bacteria at birth, so that their relationship with the microbial world starts on the right path.

"These are bugs that are dedicated to us and we're dedicated to them," said Dr Lawley.

"My main interest is - what are the bugs that are passed from mother to child? This isn't an accident, these bugs are deeply evolved with humans.

"That's what we want to understand and preserve - that form of kinship between mother and child."

What should pregnant women do?

Dr Alison Wright, the vice president of The Royal College of Obstetricians and Gynaecologists, said the findings were groundbreaking, but should not deter women from having a Caesarean.

She said: "In many cases, a Caesarean is a life-saving procedure, and can be the right choice for a woman and her baby.

"The exact role of the microbiome in the newborn and what factors can change it are still uncertain, so we don't think this study should deter women from having a Caesarean."

Follow James on Twitter.