In response to the coronavirus pandemic, countless people are covering their mouths and noses with surgical masks and buying up most stores’ inventories. The problem, as the experts keep telling us, is that most masks are ineffective for people who are not sick — and buying the better models, which people aren’t trained to use correctly, limits their availability for those who really need them. Witness, too, runs on toilet paper and, perhaps even more puzzling, paper towels.

One possible reason is that in times of heightened stress, people tend to resort to “magical thinking” and superstitious behavior — particularly when there seem to be few ways to exert control over a situation.

The first line of psychological defense in a crisis is often denial. But as evidence of the disease’s scope grows (more than 150 countries affected, over 7,000 deaths, more than 150,000 infected), documented by dire news reports, denial becomes implausible. That leaves another comforting option: clinging to the belief that one can ward off undesired outcomes by engaging in behaviors that bear little to no relationship to accepted laws of science and nature. According to a 60 Minutes/Vanity Fair poll from 2015, for example, although only 24 percent of Americans say they are “somewhat” or “very” superstitious, 60 percent “knock on wood” to prevent unwanted outcomes from occurring.

Some people who do these things may be acting out of habit or tradition, of course — not a firmly held belief in the effectiveness of it as a deterrent. But there is evidence that, for some people, magical thoughts reduce anxieties. In a study involving 167 male and female university students, Harvard University behavioral scientist Alison Wood Brooks and her team concocted a stressful event — everyone would sing, solo, in front of a group of strangers. Some of the test subjects were assigned to draw a picture encapsulating how they were feeling, throw salt over the drawing, crinkle up the paper and toss it in the garbage — arbitrary actions that the research team told participants were superstitious behaviors designed to ward off bad luck. The researchers found that the people who did these things experienced a drop in heart rate of five beats per minute compared to people who did not perform the ritual: It quieted their mounting anxieties.

While magical thinking might be a harmless habit in most situations, a quirk of human psychology, it can be deadly in others — as when people hoard masks during a pandemic.

Researchers have studied myriad ways in which people deploy magical thinking as a protection against harm. During the Gulf War in 1991, social scientist Giora Keinan surveyed 174 Israelis who were living under high and low threat of attack from Iraqi missile strikes. In Tel Aviv and Ramat Gan, the danger was high; in Jerusalem and Tiberias, it was relatively low. Keinan asked all study participants the degree to which they would be likely to (if they had the chance) rip a photograph of Saddam Hussein to pieces during a missile salvo. Or if they would step into their safest, sealed room right foot first — an act thought to bring good fortune. Israelis in the high danger regions endorsed these irrational behaviors 36 percent more strongly compared with Israelis living in safer neighborhoods. Those who were most likely to do such things were the participants who said (in a different part of the study) that they felt uneasy when they could not control events around them. Magical rituals, in short, offered an illusory sense of control.

Likewise, during the Ebola outbreak of 2016 in West Africa, in which fatality rates for the infected hovered around 50 percent, sociologist Eric Tenkorang surveyed 800 Ghanaians, and found that they generally knew the sources of transmission (contact with bodily fluids, eating brush meat like antelope), symptoms of Ebola at onset (fever, diarrhea) and effective prevention measures endorsed by the World Health Organization: washing hands with soap and altering funeral practices to avoid contact with the body of someone that had died from Ebola. But they also reported believing that hot saltwater baths acted as an effective preventive vaccine though doctors had told them otherwise — and they took such baths.

How, during the current pandemic, can we satisfy our psychological need for control — but in ways that effectively reduce transmission of the virus? We can embrace scientifically validated rituals, such as hand-washing, for one thing. We can choose whether we wash thoroughly every time we use the restroom or touch surfaces like doorknobs. We can control our exposure to others through social distancing. We can choose how we greet others — opting for elbow bumps over handshakes. These are decisions we make consciously, several times a day, and they grant us some sense of self-determination during an uncertain time.

Other decisions, such as avoiding unnecessarily travel, staying in one’s house and keeping an eye out for symptoms in oneself and one’s loved ones, are crucial — even if they don’t provide quite the same sense of control as more ritualistic behavior.

But the first step toward adopting healthy habits is recognizing our natural propensity to find protection where it can’t really be found. Which means: Ditch the face mask, grab the soap and embrace your time at home.