The original architecture of the semi desert valley is dated to early 11th century. It is ascribed to the Ibadis, with their cultural identity originally traced to the Maghreb; they had their capital at Tahert as an Ibadi Kingdom. They were forced to leave Tahert consequent to a devastating fire in 909 (it is reported that destruction was caused by the founder of the (Shi'ite) Fatimid Dynasty). They first moved to Sedrata and finally to the M'Zab valley. They settled in five fortified villages located on rocky outcrops, known locally as “Kosars”, although they could have lived in one larger village encompassing all the five. The habitation was planned with meticulous details to precise layouts defined by set principles of community living within a defensive environment. Ghardaïa's foundation has been dated to 1048 or 1053.