It's a common but erroneous belief among anti-vaxxers that if a pregnant woman gets jabbed, she puts her unborn child at risk of autism.

This couldn't be further from the truth. Instead, a growing body of research suggests that when a mother goes unvaccinated, that is when she truly leaves her child vulnerable.

A new study of nearly 1.8 million children in Sweden has found that the risks for autism and depression are significantly higher if your mother was hospitalised with an infection during pregnancy.

The results build on a nascent but burgeoning idea that specific infections, when contracted during pregnancy, can harm a developing brain, boosting the risk of psychiatric disorders coming on later in life, including conditions such as bipolar disorder, schizophreniadepression, and autism.

This new study, however, paints a much broader stroke. Instead of revealing one or two bad infections, the authors found that the results remained the same whether or not the hospitalisation was due to severe infections - like influenza, meningitis and pneumonia - or much more mild UTIs.

In other words, it isn't necessarily a specific virus, but infection in general that appears to be causing these problems, and it seems to be the case even when the affliction can't reach the fetal brain.

"The results indicate that safeguarding against and preventing infection during pregnancy as far as possible by, for instance, following flu vaccination recommendations, may be called for," says Verena Sengpiel, an expert in obstetrics and gynaecology at the University of Gothenburg. 

Drawing on data from the Medical Birth Register for almost 1.8 million children, born in Sweden between 1973 and 2014, the authors tallied how many of their mothers had been hospitalised with an infection during their respective pregnancies.

The researchers then tracked these children and their mental health through the inpatient register until 2014, when the oldest ones were turning 41.

Statistical analysis of the data revealed a worrying link between a child's mental health and their mother's immune system.

While the study did not find an increased risk of schizophrenia or bipolar disorder, the authors did find that when a pregnant woman goes to the hospital for an infection, her child is more likely to seek hospital treatment for depression and autism later on in life.

In fact, among these children, the increased risk was 79 percent for autism and 24 percent for depression.

"Overall, we found evidence that exposure to maternal infection during fetal life increased the risk of autism and possibly of depression in the child," the authors write.

"Although the individual risk appears to be small, the population effects are potentially large."

As fascinating as it is, the study is only observational, so it can't tell us exactly how a maternal infection would impact a child's developing brain.

Nevertheless, recent studies on animal models have suggested that these infections might be causing an inflammatory reaction in the nervous system, altering gene expression in the brain and changing its architecture.

The thing is, many of these studies also note there are a multitude of genetic factors at play, so the answer to this puzzle could be highly complex.

"Our results cannot exclude the possibility of increased risk for psychopathologic conditions as a result of a dual "hit": an inflammatory fetal brain injury on a background of genetic susceptibility," the authors of the new study write.

More research will be needed before we can say for sure what is going on. In the meantime, however, the best thing a pregnant mother can do is stay healthy and adhere to the best medical advice out there. Getting all your vaccinations is a good start.

This study has been published in JAMA Psychiatry.