To build the Ksar, the founders of Ghardaïa, a small group of people, under a Cheikh, chose a hill 200m South from the M'Zab Oued for defensive purposes. More on the West, they created a palm grove for subsistence farming. The Ksar of Ghardaïa, as it is today, did not appear in one time. According to the public agency in charge of protecting the M'Zab Heritage, Ghardaïa has seen four phases of evolution until 1882, when it was annexed by the french army in 1882.