New research suggests that our ancestors stayed safe at night thanks to the divergent sleep habits of the young and the old.

For most of human history, sleep was dangerous.

Our ancestors hunted, gathered, and camped on the African savanna. At night, they needed to rest, but they also needed to protect themselves from rivals and predators.

Maybe they took turns standing guard.

Or maybe, as a new study suggests, no guards were required as long as a few grandparents were around.

“The idea that there’s a benefit to living with grandparents has been around for a while, but this study extends that idea to vigilance during nighttime sleep,” says lead author David Samson, an anthropologist at the University of Toronto.

Samson and his colleagues spent 20 days and nights monitoring an extended family in Tanzania that belongs to the Hadza tribe, which still forages and camps on the savanna. Thirty-three healthy adults between the ages of 20 to 60 were equipped with “actigraphs” that measured their wakefulness day and night.

Throughout the study, the family posted no official sentinels, but there was barely a moment when everyone was asleep at once—largely because, as in most human populations, the sleep habits of the group varied with age, the researchers found. The older members of the family tended to be “larks” who went to bed as early as 8 p.m. and awakened by dawn; their younger relatives stayed up late and slept in.

Because of this variability and because all the study subjects experienced brief episodes of wakefulness during their sleep periods, an average of 40 percent of adults were awake at any given point in the night.

The researchers suspect that that early in the history of our species, the sleep habits of younger and older adults diverged as a means of promoting nighttime safety for all. They’re calling this theory the “poorly sleeping grandparent hypothesis.”

So if you find that you’re waking up earlier than you used to, there may be no reason to fret.

“A lot of older people go to doctors complaining that they wake up early and can’t get back to sleep,” says one of the researchers, Charles Nunn of the Duke Global Health Institute. “But maybe there’s nothing wrong with them. Maybe some of the medical issues we have today could be explained not as disorders, but as a relic of an evolutionary past in which they were beneficial.”