Somewhere in the murky space that divides alert from dormant — an enigmatic realm through which we all drift in the course of a good night’s sleep — the human body sometimes behaves as though it belongs to both worlds at once.

It rises from bed, ambling aimlessly. Perhaps it fiddles with household objects, cleans the kitchen or rearranges the furniture. At a glance, it seems to see, to feel, to register its surroundings. But look closer: The eyes are glassy, the movements clumsy. “These people are stuck in the nether regions between asleep and awake,” says Nathaniel Watson, co-director of the University of Washington Medicine Sleep Center.

Sleepwalking (a sleep disorder formally known as somnambulism) has mystified and intrigued humankind throughout history. Lady Macbeth suffered a bout of it in her post-homicide guilt; Dracula used it to his advantage when he lured a slumbering Lucy out of the house. Centuries later, neurologists still don’t fully understand the phenomenon, though they have made some progress.

Motion Without Memory

Until the 1950s, scientists believed sleepwalkers were simply acting out their dreams. That theory was uprooted with the discovery of rapid eye movement (REM) sleep. It’s during REM that the brain is most active and dreams most intense, and scientists found that sleepwalking almost never coincides with this stage of the sleep cycle.

Instead, sleepwalking occurs in the nondreaming phases that precede REM sleep. “They may have a single visual scene,” Watson says, “but not a dream imagery that’s complex.” To make things worse, sleepwalkers typically remember nothing of their comatose wanderings, so the somnambulists themselves can’t offer much insight. Their subjective experience is, by nature, inscrutable.

What researchers can measure is brain activity. Electroencephalograms recorded during sleepwalking episodes suggest that certain parts of the brain, like those that deal with basic motor function, remain lively while others doze. “As these primitive centers are activated, the rest of the brain — the control centers, the centers of consciousness — are shut down,” says Emmanuel During, director of the Stanford Parasomnia Clinic.

Sleepy Shenanigans

Sleepwalking is just one of many “arousal disorders,” in which the body transitions from deep sleep to semi-wakefulness at the wrong time. Many scientists argue they’re all essentially different manifestations of the same phenomenon: Some abnormal mechanism rouses the body enough to perform intricate actions, but not enough to be fully awake. Besides sleepwalking, there’s sleep-related eating disorder, sleep terrors and even sexsomnia , which is exactly what it sounds like and has been used successfully as a defense against rape charges .

There have also been reports of homicidal somnambulism, such as the 1987 case of Kenneth Parks , who claimed never to have awoken as he drove 15 miles and stabbed his mother-in-law to death (he was acquitted). Experts are divided on the authenticity of such incidents, with some deeming it more likely that unscrupulous lawyers fall back on it as a convenient excuse. Watson says he believes it’s possible, but added that “you’re probably more likely to get eaten by a shark or struck by lightning than to have a sleepwalker kill you.”

Indeed, most midnight rambles come and go without incident. In fact, During says, somnambulism is surely an underdiagnosed disorder, since sleepwalkers often return to bed and wake without ever knowing they left it. Nevertheless, a study by the Stanford University School of Medicine in 2012 found that about 3.6 percent of adults have the habit , and children are far more prolific in their nocturnal wandering. With millions of people stumbling around in the night, dispossessed of executive function, they’re sure to sleepwalk into some trouble.

Urban legend aside, a sleepwalker will not have a heart attack if woken. But because they typically come to in a haze of confusion, sleepwalkers do sometimes turn violent and injure themselves or others. On the other hand, it’s best not to leave them alone: On more than one occasion, a sleepwalker has tumbled out of a high window. The best approach is to gently guide them back to bed and look for ways to sleepwalker-proof the home.

Obscure Origins

The ultimate causes of sleepwalking are still unknown, but there are plenty of well-documented triggers. Stress, alcohol, sleep deprivation, certain medications and other disorders like sleep apnea can all induce sleepwalking. It also runs in families, so genetics seem to play a role . Children generally grow out of it as the brain matures, but adult sleepwalkers should consider seeing a specialist, though it doesn’t necessarily indicate any underlying illness.

Some researchers have suggested that sleepwalking could be an inconvenient side effect of an otherwise evolutionarily advantageous bodily process. Keeping our brain’s motor centers at the ready during sleep may have helped more than one of our ancestors avoid a late-night lion mauling. Unfortunately, Watson notes, those with the sleepwalking defect would have found it counterproductive to their survival: “If you’re wandering out of the cave at night, your chances of getting eaten are higher.”

For now, the condition retains much of its mystery. Watson says that because sleepwalking is usually no more than a mild inconvenience compared with other sleep disorders, there has been no major push to cure or study it thoroughly. As a result, he worries the public is more afraid of it than they need to be. “It’s not something to fear,” he says. “It’s something to understand and manage.”