Gharyan's unique underground houses were hewn into the mountainside centuries ago, and many lie abandoned, but residents of the Libyan town are hoping tourism can help restore their heritage.
"My great-great-great-great-great-grandfather dug this yard 355 years ago," said Al-Arbi Belhaj, who owns one of the oldest houses in the mixed Berber-Arab town south of Tripoli.
His ancestor would have used a "tajouk" pickaxe to chip away at the ground before loading the rubble into a woven date-palm "gouffa" basket to carry it away, he said.
Dug deep into the arid Nafusa mountains at around 700 meters (2,300 feet) above sea level, the home would have been protected against the scorching summers that bring temperatures up to 45 degrees Celsius (113 Fahrenheit), AFP said.
It would have also stayed warm throughout the often snowy winters.
The region's bedrock has a consistency that allowed the underground dwelling -- known as a damous -- to last for centuries without collapsing.
Some of the buildings are over 2,300 years old, and ancient Greek historians mentioned their existence, according to historian Youssef al-Khattali.
The area also has burial sites dating back to Phoenician times, he added.
Today, Belhaj says he is the owner of the oldest underground home in Gharyan, a town where many residents have family records and property deeds dating back centuries.
The warren of rooms dug into the rock around the courtyard once housed as many as eight large families, he said.
He was the last person to be born there, in 1967.
In 1990, like many people seeking more comfortable dwellings with running water and electricity, the family moved out of the home, but they kept ownership of it.
Now, Belhaj has renovated it and turned it into a tourist attraction.
- 'Designed to be versatile' -
While late dictator Moamer Kadhafi allowed tourists to visit the country on organized trips, visitors have been thin on the ground since his fall in a 2011 revolt, which sparked a decade of chaos.
But the region's Berber villages have continued to attract domestic tourists, and Belhaj is hoping that a return to relative stability could open the door to more visitors from Europe and elsewhere.
He charges an entry fee equivalent to a dollar for Libyans, or two for foreigners.
While some come for a cup of tea and to explore the building, others stay for lunch or spend the entire day there.
Damous structures were once common across a stretch of western Libya and eastern Tunisia -- the other side of a border only drawn up in 1886.
"The same tribes extend from Nalut to Gabes," said historian Khattali, referring to towns on the Libyan and Tunisian sides.
Their sites were carefully chosen and the buildings painstakingly excavated by hand to avoid them collapsing in the process.
In 1936, they attracted the attention of colonial power Italy, featuring in a tourist guide.
And they were not just used as homes.
"First of all, there were underground dwellings for humans and their animals, then buildings intended as places of worship," Khattali said, referring to synagogues and churches that were mostly later converted to mosques.
Some were also used as defenses, he said.
"You can still make out the traces of fortifications in certain parts of the mountain, including the remains of watchtowers."
The buildings "were designed to be versatile, and they've stood the test of time," Khattali said.
"That's why they're so important in the history of Libyan architecture."