The word 'Fatimid' was derived from the name of the daughter of Prophet Mohammad (Pbuh) . She married Ali Ibn Taleb , who was the Prophet's cousin and son-in-law . According to the Shiites principle , the Caliph should be one from the family of the Prophet and the sons of Ali . The leaders of Shiites escaped from the Ommeyade and later from the
Abbassid
persecution and went to Barbary , where they were welcomed by the Kitama Tribe .
Barbary had not any connection with the Caliphate , but this province was under the Aghlabid Dynasty and the Alides joined to Idrisid Dynasty . Then , Abdullah El-Shi' I , the new leader of the Shiites succeeded in preparing an army of 200 , 0000 men and went to Barbary . After several battles , he completely defeated the Aghlabid prince and the Aghlabid Dynasty came to an end . Abdullah El-Shi'I declared "Obeydallah el-Mahdi the Caliph and Chief of Islam . "