In the arid valleys of southern Tunisia's Djebel Dahar region, people have lived for centuries in underground houses whose earthen casing provides protection against searing summer heat and winter winds.
But in recent decades, rural depopulation has meant fewer people live in the homes, which are composed of rooms hewn into the walls of an excavated circular courtyard. The few remaining families say they are attached to the homes and the land or see no way of moving.
The homes are concentrated around Matmata, which lies in a cratered landscape dotted with palm trees and olive groves about 365 km (227 miles) south of Tunis.
They are highly unusual, though similar constructions are found across the border in Libya, to the southwest. In other parts of the Djebel Dahar, houses and storerooms were carved from rock and earth above ground.
Many families left the underground houses when new towns and villages were built in the 1960s and 1970s as part of a modernisation drive by President Habib Bourguiba.
Locals suspect Bourguiba wanted to dilute Berber communities as he strove to integrate them into the Arab nation after independence from France.
Disputes over inheritance and periods of drought or heavy rain, which can cause the houses to collapse, also contributed to the rural exodus.
Some built modern houses on adjoining land, using the traditional homes as stables or workshops.
Residents live largely off olive farming and tourism. Matmata became a popular destination after a troglodyte home converted into a hotel was used as a Star Wars set in the 1970s.
But tourism across Tunisia is still recovering from a sharp decline after the country's 2011 Arab Spring uprising and major attacks targeting tourists in Tunis and Sousse in 2015.
Hedi Ali Kayel, 65, who runs a small shop in the village of Haddej, is one of the last people in the area who knows how to build and maintain the houses. The last new house he dug was in the 1970s.
Now he is fighting a lonely battle to save the ones that still exist.
In his words "Every time there's rain I come and repair them, I don't let them go."