Vitamin D deficiency before and after birth may increase the risk of multiple sclerosis in some individuals, a study has shown.
Scientists have found evidence that MS susceptibility is influenced by vitamin D levels coupled with a common genetic variant.
Children with the gene mutation may be more at risk of developing the disease if they lack vitamin D while growing in the womb or during their early years of life.
The researchers suggest that as a precaution mothers should take vitamin D supplements during pregnancy or give them to their young children.
MS is the most common disabling neurological condition affecting young adults. More than 85,000 people in the UK and 2.5 million worldwide are thought to suffer from the condition, which results from the loss of nerve fibres and their protective myelin sheath "insulation".
Although the causes of MS are unclear, experts believe both environmental and genetic factors play a role.
Previous studies have shown that populations from northern Europe are more at risk of MS if they live in areas with little sunshine.
This could be explained by the link with vitamin D, which is produced in the skin through the action of sunlight.
The largest genetic influence on MS is known to arise from a gene variant called DRB1*1501 and neighbouring DNA sequences.
While one in 1,000 people in the UK is likely to develop MS, the incidence rises to around one in 300 for those carrying a single copy of the variant. People with two variant copies of the gene pair have a one in 100 chance of developing the disease.
Researchers at Oxford University and the University of British Columbia in Canada established a direct relationship between DRB1*1501 and vitamin D.
They found that proteins activated by vitamin D in the body effectively flick a molecular switch that turns the gene on.
Co-author Dr Julian Knight, of the Wellcome Trust Centre for Human Genetics at Oxford University, said: "In people with the DRB1 variant associated with MS, it seems that vitamin D may play a critical role. If too little of the vitamin is available, the gene may not function properly."
The scientists believe the gene-vitamin interaction might impair the thymus gland, a "factory" for immune system cells located in the chest.
The thymus produces an army of white blood cells known as T-cells, which identify invaders such as bacteria and viruses and attack and destroy them. There are millions of different T-cells designed to recognise specific invaders, but sometimes they can mistakenly target the body's own cells or proteins.
Normally the thymus regulates the T-cells and deletes those that pose the greatest risk of "friendly fire". However, the researchers believe that in people with the genetic variant, a lack of vitamin D during early life might remove this safeguard. Rogue T-cells are then allowed to continue to attack the body, leading to a loss of myelin from nerve fibres.
Study leader Professor George Ebers, from Oxford University, said: "We have known for a long time that genes and environment determine MS risk. Here we show that the main environmental risk candidate - vitamin D - and the main gene region are directly linked and interact."
The findings are published online today in the journal PLoS Genetics.
Another member of the Oxford team, Dr Sreeram Ramagopalan, said: "Our study implies that taking vitamin D supplements during pregnancy and the early years may reduce the risk of a child developing MS in later life.
"Vitamin D is a safe and relatively cheap supplement with substantial potential health benefits. There is accumulating evidence that it can reduce the risk of developing cancer and offer protection from other autoimmune diseases."
Simon Gillespie, chief executive of the MS Society, which part-funded the research, said: "These remarkable results tie together leading theories about the environment, genes and MS but they are only part of the jigsaw.
"This discovery opens up new avenues of MS research and future experiments will help put the pieces together."