Our ancestors didn’t suffer from hay fever and food allergies were extremely rare even a few decades ago. What is causing the steep rise in their incidence now?

To anyone from Generation X or older, it often feels like food allergies are far more common today than in their youth. While they remember them being rare or nonexistent in their school days, their own children will have classmates with allergies or they may have one themselves.

According to the Food Standards Agency, estimates suggest that about 5-8% of children and 1-2% of adults are affected by food allergies in the UK. The recent headlines about fatal allergic reactions, such as that of two Pret a Manger customers, heighten the impression that food allergies are more commonplace.

So is the impression that they are increasing correct and what is causing it? And what has gone so wrong with our bodies that we might be killed by something as seemingly harmless as a sesame seed?

Since 1906, when the word “allergy” was first used, the number of those affected has been climbing. Asthma has probably always been a problem but if ancient records of it are anything to go by, it was also exceptionally rare.

Facebook Twitter Pinterest Everybody’s doing it: hay fever appears to get more and more common the more distant we grow from nature. Photograph: Alamy Stock Photo

Hay fever was first documented in the 19th century. Physician John Bostock was one of the first to collate data and when he scoured the country to find hay fever sufferers, his total haul of cases was laughably small to a modern audience: 28.

Morell Mackenzie, a British physician in the 1880s, noted that since “summer sneezing goes hand-in-hand with culture, we may, perhaps, infer that the higher we rise in the intellectual scale, the more is the tendency developed”. From their outset, allergies were linked with those more distanced from rural upbringings.

Between the 1950s and the 1980s, as the 2007 studies Time Trends in Allergic Disorders in the UK and 50 Years of Asthma explain, the numbers who struggled with hay fever, eczema and asthma “increased substantially”. Conversely, the air (according to Defra) has been getting less, not more, polluted. Even with fewer allergens around, our symptoms seem to be spreading wider.

The crucial things are contact with green space and avoidance of antibiotics – and a varied diet… Prof Graham Rook

Before the 1990s, peanut allergy was so rare that barely any data on it was collected. In a 2015 article in the Journal of Allergy and Clinical Immunology, Paul J Turner noted that even though admissions to hospital for anaphylaxis increased between 1992 and 2012 by 615%, the incidence of fatal anaphylaxis did not. Turner and his colleagues believed that “increasing awareness of the diagnosis, shifting patterns of behaviour in patients and healthcare providers” might be contributing factors. Even though peanut allergy is much more common, its associated fatalities have not increased.

Prof Katie Allen of the Murdoch Children’s Research Institute in Melbourne, Australia, who is 10 years into HealthNuts, a study tracking food allergy in 5,300 Australian children, explains that she was “astounded” by its first results. When the trial began, they were expecting to find about one in 20 of their one-year-old subjects testing positive for nut allergy, but they found double that. Allen explains: “The food allergy epidemic has happened after the asthma/hay fever epidemic. We call it the second epidemic of allergic disease.”

Genetic studies are well on their way to unravelling the relationship between our DNA and allergies. Large case studies of, for example, 50,000 eczema sufferers, or 60,000 of those with hay fever, are beginning to show that it could be as few as 20 to 40 of our 20,000 genes that form the genetic architecture of allergy.

Dr Manuel Ferreira, a specialist in the genetics of asthma at the QIMR Berghofer Medical Research Institute in Brisbane, Australia, explains that in a new (about to be published) study, he and his team have discovered that the “genetic risk factors for food allergy overlap significantly with those for other allergic diseases, such as asthma and hay fever”.

Genes play a role, then, but the fact that we will have been carrying similar DNA for thousands of years without being so allergic suggests environment is a key factor. Dr Paul Gray, staff specialist in paediatric immunology and allergy at Sydney children’s hospital explains: “The net genetics of the population changes little over time, so epidemics are driven by non-genetic changes.”

Facebook Twitter Pinterest Natasha Ednan-Laperouse, who died after eating a Pret a Manger sandwich containing sesame, to which she was allergic, in July 2016. Photograph: Ian McIlgorm

While the symptoms of different conditions are varied in type and seriousness, what binds these irritants together is that they are all overreactions of the body’s immune system when exposed to a usually harmless trigger. Gray explains that allergy is “an accident of immune recognition leading to the mounting of an aggressive response against something foreign but innocuous, with deleterious consequences for the host.”.

As to why there are more food allergies today, nobody knows the precise reason, but experts now believe there are three contributing factors.

The first is the delayed introduction of allergens. For years, throughout the world, allergy specialists had been advising that infants avoid the consumption of potentially allergenic foodstuffs. Not only was this incorrect but it may have played a role in driving the food allergy epidemic that we are seeing today.

Prof Gideon Lack of King’s College London, lead investigator on Learning Early About Peanut Allergy (the LEAP study) found that “of the children who avoided peanuts, 17% developed peanut allergy by the age of five years. Remarkably, only 3% of the children who were randomised to eating the peanut snack developed allergy by age five.” The children involved in the trial already had severe eczema and/or an egg allergy (both strong predictors for nut allergy).

The introduction of potential allergens at the same time as an infant transfers to solids seems like a good idea. It’s a brave thing though, as a parent, to risk exposure. Dr Gray explains: “Most parents are beginning to realise that early introduction of foods is vital but many don’t feel brave enough to do this at home and the in-hospital resources don’t exist to do introduction in hospital. This needs to be fixed.”

The second contributory factor in food allergy (and allergy more generally) involves the human microbiome and the microorganisms that are our “old friends”. The body learns about its environment after it is born by coming into contact with an array of substances, everything from the bacteria we are smothered in as we travel down the birth canal to the breast milk we are fed on. After that, proximity to animals and natural environments makes it more likely that we will be exposed to a wide variety of bacterial life, in the air, on the ground and in our diet. All of these help populate our bodies, but particularly our gut, with microbiota. This is such an important part of being human that microbiota outnumber us within our own bodies: humans are made up of something between 27tn and 37tn cells; but we carry about 100tn of these organisms within us. We are astonishingly complex ecosystems. The “old friends” or hygiene hypothesis postulates that modern life has compromised our microbiome: our immune systems may now incorrectly categorise harmless substances as a threat.

The complexity of our microbiomes has led some to distrust the conclusions drawn from the “old friends” hypothesis. A recent systematic review (Hygiene Hypothesis in Asthma Development: Is Hygiene to Blame?) called for “caution”, considering the hypotheses too general to explain the complex nature of a disease such as asthma and the ways that it presents in different parts of the world.

Nonetheless, imbalances in gut ecology have been strongly linked with allergies.

As adults, the ecology in our gut is well developed, but we can still help influence it. Prof Graham Rook, an immunologist at University College London’s Centre for Clinical Microbiology, explains that the “crucial thing is contact with green space and the natural environment, and avoidance of antibiotics, and of things that limit that transmission of maternal microbiota to the infant. And we need a varied diet with many different fruits and vegetables, because these things maintain the biodiversity of the microbiota.”

Probiotics stimulate the growth of microbiota. The fact that people who suffer severe allergies have substantially less diverse (and less dense) flora in their gut suggests that the future of allergy therapy could be in probiotic interventions. But you can’t just go to the supermarket and grab a probiotic drink off the shelf and expect it to be efficacious. A mass-produced probiotic is about as successful as mass-produced false teeth. Scientists are working on personalised probiotic therapies but they are many years from being a safe and effective treatment.

Astonishing pieces of research such as Hunt for the Origin of Allergy and Innate Immunity and Asthma Risk have compared genetically homogenous groups that have strikingly different lifestyles – respectively, the urbanised Finnish and rural Russian populations of Karelia, and children on traditional Amish and more industrialised Hutterite farms in the US – and how they show huge disparities in the prevalence of allergy. This science shows that it’s the distance from, and lack of exposure to, natural environments that is driving the allergy epidemic in modern life.

Facebook Twitter Pinterest Packed with goodness? A lack of vitamin D can cause an allergic reaction to eggs. Photograph: Glow Cuisine/Getty Images/Glow RM

The final, third driver of food allergy, also connected to urban life, is associated with the curious fact that there is an approximate geographical spread of food allergy. Scientists have begun to notice that the prevalence of food allergy has a tendency to align with the geographical availability of sunlight. In a number of papers and studies, Prof Carlos Camargo in the US and Prof Katie Allen and her colleagues in Australia have explored how a lack of exposure to sunlight – and a consequent vitamin D deficiency – can make infants three times more likely to have an egg allergy and a staggering 11 times more likely to have a peanut allergy.

Urban life makes it harder for us to be regularly exposed to natural environments. We also spend more time indoors, which makes vitamin D deficiency more common throughout the population, but particularly in children. In the UK, parents are advised to “cover exposed parts of your child’s skin with sunscreen, even on cloudy or overcast days”.

As we gather together in ever greater numbers, it is the green spaces and natural environments between us that get squeezed out, taking with them countless opportunities for our immune systems to learn about the world around us and for us to have essential access to sunlight. And although there are many factors involved, levels of urbanisation look to be one of the strongest predictors for the prevalence of allergy in a population, both historically and in the future.

• Primate Change: How the World We Made Is Remaking Us by Vybarr Cregan-Reid is published by Octopus (£16.99). To order a copy for £14.61 go to guardianbookshop.com or call 0330 333 684. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99