Fatimid Caliphate

The Fatimid Caliphate was ruled by the al-Fātimiyyūn () dynasty from 5 January 909 to 1171. It was an Arab Shi'a dynasty It ruled the fourth and final Arab caliphate. In different times different areas of the Maghreb, Egypt, and the Levant belonged to the caliphate.
Egyptian city of Cairo was made the capital. The term "Fatimite" is sometimes used to refer to the citizens of this caliphate as well. The ruling elite belonged to the Ismaili branch of Shi'ism. The leaders were also Shia Ismaili Imams. They had a religious significance to Ismaili Muslims. They are also part of the chain of holders of the office of Caliph, as recognized by most Muslims, the only period in which the Shia Imamate and the Caliphate were united to any degree. There was only one other exception: the Caliphate of Ali himself.
The Fatimids were famous for religious tolerance towards non-Ismaili sects of Islam as well as towards Jews, Maltese Christians and Coptic Christians, but there were some exceptions nevertheless.
Rise of the Fatimids.
The Fatimids came from Ifriqiya, modern-day Tunisia and eastern Algeria. The dynasty was founded in 909 by , who legitimised his claim through descent from Muhammad by way of his daughter Fātima as-Zahra and her husband , the first Imām, hence the name "al-Fātimiyyūn" "Fatimid".
Abdullāh al-Mahdi's control soon extended over all of central Maghreb, an area consisting of the modern countries of Morocco, Algeria, Tunisia and Libya, which he ruled from Mahdia, his newly-built capital in Tunisia.
Decay and fall.
In the 1040s, the Zirids (governors of North Africa under the Fatimids) declared their independence from the Fatimids and their conversion to Sunni Islam, which led to the devastating Banū Hilal invasions. After about 1070, the Fatimid hold on the Levant coast and parts of Syria was challenged first by Turkic (Seljuk) invasions, then the Crusades, so that Fatimid territory shrank until it consisted only of Egypt.
After the decay of the Fatimid political system in the 1160s, the Zengid ruler Nūr ad-Dīn had his general, Shirkuh, seize Egypt from the vizier Shawar in 1169. Shirkuh died two months after taking power, and the rule went to his nephew, Saladin. This began the Kurdish Ayyubid Dynasty.