It felt strange when Boris Johnson emerged from the first Covid-19 Cobra meeting on 2 March and told us to wash our hands while singing Happy Birthday. The preppers among us had panic-shopped while awaiting his pronouncements, and others fretted about vulnerable loved ones, travel plans, the nightmare of simultaneous homeworking and home-schooling, and not being able to work at all. And all our leader had was this?

As one of the few things we can do to significantly stop the spread of coronavirus while out in the infectious world, the new rules for this everyday habit have become the meme du jour. The Killers’ frontman, Brandon Flowers, tweeted a video of himself lathering up while crooning his hit Mr Brightside to 4 million followers. Judi Dench and Gyles Brandreth have posted themselves online reciting The Owl and the Pussycat with sudsy hands. A website for generating handwashing infographics to the song lyrics of your choice has gone viral.

To Nancy Tomes, a distinguished professor of history at Stony Brook University, New York, seeing this basic advice headlining the public health agenda has felt even more strange. “Being a historian of this kind of pandemic event and then experiencing this one,” she says, “is kind of like being a passenger on the Titanic and watching it all unfold.” It also feels, she says, like going back to the early 20th century, when infectious diseases such as tuberculosis and smallpox were the No 1 cause of death, and the new science of germs had led to the first mass obsession with hand hygiene.

Religious handwashing rituals have been around for thousands of years in Islamic, Jewish and other cultures, but the notion of disease spreading by hand has been part of the medical belief system for only about 130 years. However, the first recorded discovery of handwashing’s life-saving power came 50 years earlier, in 1848, as a huge, unwelcome shock.

“If there had to be a father of handwashing it would be Ignaz Semmelweis,” says Miryam Wahrman, a professor of biology at William Paterson University in New Jersey and author of The Hand Book: Surviving in a Germ-Filled World. While working at Vienna General hospital, the Hungarian doctor was at the forefront of a more scientific approach to medicine. Faced with a doctor-led maternity ward in which maternal deaths from the dreaded childbed fever were significantly higher than in the midwife-run clinic there, he racked his brain for clues as to why.

Joseph Lister and his assistants. Photograph: Pictorial Press Ltd/Alamy

Germs were yet to be discovered, and it was still believed in the 1840s that disease was spread by miasma – bad smells in the air – emanating from rotting corpses, sewage or vegetation. Victorians kept their windows firmly shut against such malevolent forces. So it didn’t seem a problem that trainee doctors at Vienna General would hang out in the morgue dissecting corpses to figure out what had rendered them dead and then pop up to the maternity ward to deliver a baby without washing their hands.

One of them then accidentally got cut by a scalpel during a dissection and died, seemingly of the same childbed fever the mothers had been getting. Semmelweis hypothesised that cadaverous particles from the morgue were to blame, and that such particles on the hands of doctors were making their way into women’s bodies during childbirth.

To test his theory, he ordered doctors to wash their hands and instruments in a chlorine solution, a substance he hoped would dispatch the deadly smell of cadaverous particles. Before the experiment, says Wahrman, “the mortality rate for new mothers was as high as 18%. After Semmelweis implemented hand hygiene between the morgue and the delivery room, the rate of mortality for new mothers dropped to about 1%.”

Despite his success, his idea faced great resistance, and met a tragic end. He lost his job, and is thought to have had a breakdown. He died in a psychiatric institution, “a very despondent person at the untimely age of 47”, says Wahrman.

Part of the problem, says Tomes, was that people, “didn’t have that conception of themselves as sort of walking petri dishes”. And doctors were offended by the suggestion that they could be causing infections. “The majority of doctors in Vienna at this time were from middle- or upper-class families, and they thought of themselves as very clean people compared with the working-class poor. He was insulting them when he said their hands could be dirty.”

Over the next 40 years, an understanding of germs developed, and attitudes to hygiene gradually shifted. In 1857, while Semmelweis’s mental health declined, Louis Pasteur, of pasteurisation fame, raised awareness of pathogens, and how to kill them with heat. In 1876, the German scientist Robert Koch discovered the anthrax bacillus, kicking off the new research field of medical bacteriology. Cholera, tuberculosis, diphtheria and typhoid bacilli were subsequently identified.

Surgeons started handwashing in earnest. Tomes says: “If you’re cutting open someone’s skin – that protective layer – you need to take extraordinary precautions.” The British surgeon Joseph Lister pioneered antiseptic surgery, which included handwashing, “and by the 1890s and into the early 1900s,” adds Tomes, “handwashing moved from being something doctors did to something everybody had been told to do”.

Florence Nightingale helped. Despite still labouring under miasma theory, she intuitively improved hygiene in military hospitals during the Crimean war in the 1850s and, after returning to the UK, set about revolutionising nursing. “Nightingale influenced a new interest in household cleanliness as a goal that a good wife and mother needs to instil in her family,” says Tomes.

We thought this hygiene stuff was bourgeois nonsense. Being a hippy involved embracing your microbial self

The turn of the century saw the first popular public health campaigns being launched around tuberculosis, says Tomes. “Koch had shown that tuberculosis was not something you inherited from your grandmother, but that your grandmother coughed on you, and that’s why you got it.” The anti-tuberculosis movement was aimed at both adults and schoolchildren. “You really were getting little kids taught these rules about being clean and washing your hands.”

Tomes adds: “People got totally phobic about shaking hands or kissing each other when they understood that their mouth, their skin and their hair had all these germs on them.” It’s one reason, she says, why young men started eschewing beards at the turn of the century. And why foods started being sold individually wrapped, because of “this fear of germs and hands touching things”. But this hygiene-centric era was short-lived.

The combination of public health messaging and the development of vaccines and antibiotics in the early 20th century saw death rates from bacterial diseases plummet. “The hyperattention to this kind of cleanliness became less important,” says Tomes. “A laxity crept in, I think, in healthcare and in everyday life after the second world war.”

Tomes herself is a product of the countercultural baby boomer generation, which rebelled against the rules imposed by their parents’ and grandparents’ generations. “We thought all this [hygiene] stuff was bourgeois nonsense,” she says. “Being a hippy involved embracing the wonders of your microbial self.”

Sexually transmitted diseases started increasing again in the 1970s. “People started to realise, well, these things can come back if we get careless,” says Tomes. “But it was really with HIV coming in the 1980s – a novel, deadly, sneaky kind of virus – that everyone started to get hyper again about personal cleanliness.” Even though, of course, HIV is transmitted by blood, semen, vaginal fluids and breast milk, so hand hygiene isn’t a significant factor in prevention, Tomes says we have been operating with a more aware mindset in general since then. Hospital superbugs became a problem, “and now we have these novel viruses coming pretty regularly, but we’re also getting the re-emergence of bacterial diseases because of antibiotic resistance”.

Actual handwashing compliance, pre-coronavirus, was still worryingly low, however, in the public realm and in medical care. In her book, Wahrman cites research undertaken with university students in 2009, published in the American Journal of Infection Control. “After urinating, 69% of women washed their hands, and only 43% of men,” she says. “After defecation, 84% of women and 78% of men washed their hands. And before eating – a critical time to wash your hands – 10% of men and 7% of women washed their hands.”

‘At the start of a pandemic, this is pretty much all you’ve got.’ Photograph: EyeEm/Alamy

Wahrman’s mother died from a hospital-acquired infection, so writing the book, she says, “was personal”. A study conducted in a teaching hospital at East Tennessee State University in 2007 found that staff handwashing between attending patients in all intensive care units (ICUs) had an overall compliance rate of just 54%. Staff in the paediatric ICU were much more conscientious, with 90% compliance, compared with just 35% in the adult ICU. After intervention and training, however, the compliance rate in the adult ICU was raised to 81%. We can only hope that the memes of the Covid-19 pandemic will see similar or even better rises among the public.

How effective is handwashing? Petra Klepac, an assistant professor of infectious disease modelling at the London School of Hygiene & Tropical Medicine, looked into this question in 2018 while predicting how a flu pandemic would spread in the UK, for the documentary Contagion! The BBC Four Pandemic.

“We were looking for systematic reviews and meta-analyses, and pooling the results from these studies,” she says. One review, published in 2017, found significant effects from handwashing, compared with nonsignificant effects from face-mask use. When Klepac and colleagues drilled down into the highest quality data, gathered from a clinical setting, with clinical diagnosis and a control group (who didn’t increase hand hygiene) they discovered that if you washed your hands five to 10 times more than usual, “that would reduce your risk by a quarter”.

At the start of a pandemic, this is pretty much all you’ve got. “You don’t have pharmaceutical interventions,” says Klepac. “You don’t have a vaccine. This is why we’re looking at nonpharmaceutical measures that are easily implemented.”

To Wahrman, this knowledge feels empowering. “You can say to people: ‘Here’s one thing you can do to lower your risk.’ It’s simple. It’s right there and doesn’t cost anything. Wash your hands with soap before you touch your mouth, your nose or your eyes. It’s empowering because it really does make a difference.”