The burials spanned thousands of years, suggesting the place was a persistent cemetery for the local people, researchers said.
"It must have been a place of memory. People throughout time have kept it, and they have buried their people, over and over, generation after generation," said study co-author Mary Anne Tafuri, an archaeologist at the University of Cambridge.
About 15 women and children were buried in the rock shelter, while five men and juveniles were buried under giant stone heaps called tumuli outside the shelter during a later period, when the region turned to desert.
From about 8,000 to 6,000 years ago, the Sahara desert region, called Wadi Takarkori, was filled with scrubby vegetation and seasonal green patches, LiveScience reported.
More From This Section
Stunning rock art depicts ancient herding animals, such as cows, which require much more water to graze than the current environment could support, Tafuri said.
Tafuri and colleague Savino di Lernia began excavating the archaeological site between 2003 and 2006. At the same site, archaeologists also uncovered huts, animal bones and pots with traces of the earliest fermented dairy products in Africa.
To date the skeletons, Tafuri measured the remains for concentrations of isotopes, or molecules of the same element with different weights.
The males and juveniles under the stone heaps were buried starting 4,500 years ago, when the region became more arid. Rock art confirms the dry up, as the cave paintings began to depict goats, which need much less water to graze than cows, Tafuri said.
The study was published in the Journal of Anthropological Archaeology.