But here's what I find very interesting in the "association". The use of an antibiotic to treat the infection was associated with about a 40% increased risk of a later mental disorder. Since various antibiotics were used, it's possible that a specific class of antibiotics was the primary cause of mental disorders. It might have been fluoroquinolones for example. We already know that they can cause peripheral neuropathy in adults.
Here's another way to look at the results: Maybe the infections only cause mental disorders in 40 % of the cases and the other 40 % are caused by antibiotics (with no contribution from the infection). The real question is whether the infection causes the mental disorders despite the use of antibiotics, or whether the mental issues are caused by the antibiotics.
Interestingly, the study found:
A Nationwide Study in Denmark of the Association Between Treated Infections and the Subsequent Risk of Treated Mental Disorders in Children and AdolescentsFindings
This nationwide register-based cohort study that included 1 098 930 individuals born in Denmark between 1995 and 2012 found that severe infections requiring hospitalizations increased the risk of hospital contacts due to mental disorders by 84% and the risk of psychotropic medication use by 42%. Less severe infection treated with anti-infective agents increased the risks by 40% and 22%, respectively; the risks differed among specific mental disorders.
IOW, it appears that antibiotics can adversely affect developing brains. This reminds me of the claim by many that too many (childhood) vaccinations in a short period can have adverse effects on developing immune systems.
But maybe I'm just being paranoid.
Tex