Scientists believe they have discovered the genetic code that makes some people sleepwalk.
By studying four generations of a family of sleepwalkers they traced the fault to a section of chromosome 20.
Carrying even one copy of the defective DNA is enough to cause sleepwalking, the experts told the journal Neurology.
They hope to target the genes involved and find new treatments for the condition that affects up to 10% of children and one in 50 adults.
Most often, sleepwalking is a fairly benign problem and something that will be outgrown.
Many children will have episodes where they will arise from their sleep in a trance-like state and wander.
But more extreme cases of sleepwalking can be deeply disruptive and downright dangerous, particularly when the condition persists into adulthood.
Sleepwalkers may perform complex feats such as locating the car keys, unlocking the doors and then driving.
There have even been high-profile cases where sleepwalkers have killed during an episode.
Despite this relatively little is known about the phenomenon, called somnambulism by medics.
Experts do know that sleepwalking tends to run in families and that some people are particularly susceptible to it.
And factors like being over-tired or stressed can be the trigger.
Typically, episodes happen early in the night, soon after the individual has fallen asleep and is in the deep, dreamless "slow wave" or non-rapid eye movement (NREM) stage of sleep.
By morning, the person will usually have no recollection of the episode.
For the latest study, Dr Christina Gurnett and colleagues at the Washington University School of Medicine sought the help of a large family of sleepwalkers.
The family had been referred to them because one of the youngest members, a 12-year-old girl called Hannah, had been experiencing particularly troublesome sleepwalking, which regularly caused her to leave the house and roam during the night.
Among the four generations of the family, spanning from the great-grandparents downwards, nine members out of the 22 were sleepwalkers.
One family member - an uncle of Hannah's - frequently wakes to find he has put on eight pairs of socks during the night. Some of her other sleepwalking relatives have suffered injuries such as broken toes during their nocturnal wanderings.
Using saliva samples the researchers analysed the family's DNA to unpick the genetics of the condition.
A genome-wide search revealed the problem stemmed from genetic code housed on chromosome 20, and that this code had been passed down from generation to generation. Someone with the gene has a 50% chance of passing it on to their children.
And any individual who inherited a copy of the faulty DNA would be a sleepwalker, they found.
Although they have yet to identify the precise gene or genes involved - there are a potential 28 - their hunch is that it will be the adenosine deaminase gene that is the culprit.
This gene, which sits in the minute segment of chromosome 20 that the researchers identified, is already known to be linked to the slow wave sleep that sleepwalking occurs within.
Dr Gurnett said: "It is likely that several genes will be involved. What we have found is the first genetic locus for sleepwalking.
"We do not know yet which of the genes in this linkage region of chromosome 20 will be responsible. Until we find the gene we won't know whether this accounts for several families or a large number of families who have sleepwalking.
"But discovering these genes could help with identifying and treating the condition."
Dr Malcolm von Schantz, a sleep expert at the University of Surrey, said: "This provides the proof of concept. We are beyond the needle in the haystack stage. It's now become feasible to find out which mutation in which gene is responsible."