The Fatimids claimed descent from Fatimah, the daughter of Islamic prophet Muhammad. The Fatimid state took shape among the Kutama Berbers, in the West of the North African littoral, in Algeria, in 909 conquering Raqqada, the Aghlabid capital. In 921 the Fatimids established the Tunisian city of Mahdia as their new capital. In 948 they shifted their capital to Al-Mansuriya, near Kairouan in Tunisia. In 969 they conquered Egypt and established Cairo as the capital of their caliphate; Egypt became the political, cultural, and religious centre of their empire. The Fatimid caliphate was distinguished by the central role of Berbers in its initial establishment and in helping its development, especially on the military and political levels.
The ruling class belonged to the Ismaili branch of Shi'ism, as did the leaders of the dynasty. The existence of the caliphate marked the only time the descendants of Ali and Fatimah were united to any degree (except for the final period of the Rashidun Caliphate under Ali himself from 656 to 661) and the name "Fatimid" refers to Fatimah. The different term Fatimite is sometimes used to refer to the caliphate's subjects.
After the initial conquests, the caliphate often allowed a degree of religious tolerance towards non-Ismaili sects of Islam, as well as to Jews, Maltese Christians, and Egyptian Coptic Christians. However, its leaders made little headway in persuading the Egyptian population to adopt its religious beliefs.
During the late eleventh and twelfth centuries the Fatimid caliphate declined rapidly, and in 1171 Saladin invaded its territory. He founded the Ayyubid dynasty and incorporated the Fatimid state into the Abbasid Caliphate.
The Fatimid Caliphate's religious ideology originated in an Ismaili Shia movement launched in the 9th century in Salamiyah, Syria by the eighth Ismaili Imam, Abd Allah al-Akbar (766-828). He claimed descent through Ismail, the seventh Ismaili Imam, from Fatimah and her husband ʻAlī ibn-Abī-Tālib, the first Shīʻa Imām, whence his name al-Fātimī "the Fatimid". The eighth to tenth Ismaili Imams, (Abadullah, Ahmed (c. 813-c. 840) and Husain (died 881)), remained hidden and worked for the movement against the rulers of the period.