It was an ordinary night, but Salma, a 20-year-old student at The American University in Cairo, had a particularly frightening experience. She woke up, unable to move a muscle, and felt as though there were an intruder in her bedroom. She saw what appeared to be a fanged, bloody creature that looked like "something out of a horror movie," standing beside her bed.

She later explained her experience to researchers who were conducting a survey about sleep paralysis, a common but somewhat unexplained phenomenon in which a person awakens from sleep but feels unable to move. Up to 40 percent of people report experiencing sleep paralysis at some point in their lives, and a few, like Salma, hallucinate shadowy intruders hovering over them.

"Sleep paralysis can be a very frightening experience for some people, and a clear understanding of what actually causes it would have great implications for people who suffer from it," said Baland Jalal, a neuroscientist at the University of California, San Diego.

Researchers say that sleep paralysis happens when a person awakens during a stage of sleep known as rapid eye movement (REM). People in this stage of sleep are usually dreaming, but their muscles are nearly paralyzed, which might be an evolutionary adaptation that keeps people from acting out their dreams.

It is harder to explain why a subset of people who experience sleep paralysis feel a menacing figure in their room or pressing on their chests. [Senses and Non-Sense: 7 Odd Hallucinations] One possible explanation could be that the hallucination is the brain's way of clearing out confusion, when there's a disturbance in the brain region that holds a neural map of the body or the "self," according to a recent article that Jalal and his colleague Vilayanur Ramachandran, of UC San Diego, published in the journal Medical Hypotheses.

"Perhaps, in part of the brain, there's a genetically hardwired image of the body — a template," Jalal told Live Science. Previous studies have suggested that such a region may be a part of the parietal lobes, which are situated in the top-middle part of the brain.

It is possible that during sleep paralysis, the parietal lobes monitor the neurons in the brain that are firing commands to move, but aren't detecting any actual movement in the limbs, which are temporarily paralyzed. This may lead to a disturbance in how the brain builds a sense of the body image, Jalal said. The appearance of a bedroom intruder could result when the brain tries to projectthe person's own body image onto a hallucinated figure, he said.

This idea, though intriguing, would be very difficult to test, Jalal said. One way to gather evidence showing whether this is what is happening inside the brain during sleep paralysis would be to test people who have different body images. For example, if this idea is true, people who are missing a limb might hallucinate figures who are missing the same limb, Jalal said. Still, people with such different body images are likely a small subset of the population, and it would be difficult to conduct such an experiment, he said.

What's so frightening about sleep paralysis?

It's also possible that people's differing experiences of sleep paralysis are due to differences in their cultural beliefs. Previous research has suggested that certain ideas found in people's cultures could shape how they experience certain phenomena, Jalal said.

For example, in a 2013 study published in the journal Cultural, Medicine, and Psychiatry, Jalal and his colleague Devon Hinton, of Harvard Medical School, looked at the rates of sleep paralysis, and the amount of stress that people felt because of the episodes, among people of two different societies: Egypt and Denmark. They found that, compared to study participants in Denmark, the Egyptians experienced sleep paralysis more frequently, and had more prolonged episodes that were accompanied with a greater fear of dying from the experience. [Top 10 Spooky Sleep Disorders]

"These are two very different cultures; Egypt is very religious, whereas Denmark is one of the most atheist countries in the world," Jalal said.

Most of the Danish participants said they thought sleep paralysis was caused by physiological factors, brain malfunctioning or sleeping the wrong way, whereas the Egyptians were more likely to believe that sleep paralysis is caused by the supernatural.

In another survey, about half of the Egyptian participants from that study said they thought their sleep paralysis was inflicted by a jinn, a ghostlike, menacing creature from Islamic mythology, according to the study, published in the journal Transcultural Psychiatry in 2014.

Jalal and his colleagues concluded that people with such supernatural beliefs tend to experience more fear during sleep paralysis, as well as longer episodes of it. It is even possible that the fear actually contributes to an increase in the person's severe episodes of sleep paralysis, and vice versa, Jalal said.

"If you have fear, the activation in fear centers in the brain might mean more likelihood of fully awaking during sleep paralysis, and experiencing the whole thing," Jalal said. "And by experiencing it, you would have more fear — and then, you have all these cultural ideas of what it is added as well, and now you are even more scared of it."

Jalal said he thinks finding a scientific explanation for sleep paralysis could help people who have particularly frightening and stressful episodes because they've culturally learned to attribute it to supernatural beings.

Email Bahar Gholipour. Follow Live Science @livescience, Facebook & Google+. Originally published on Live Science.