The Shiʻa Ubayd Allah al-Mahdi Billah of the Fatimid dynasty, who claimed descent from Muhammad through his daughter, claimed the title of Caliph in 909, creating a separate line of caliphs in North Africa. Initially controlling Algeria, Tunisia and Libya, the Fatimid caliphs extended their rule for the next 150 years, taking Egypt and Palestine, before the Abbasid dynasty was able to turn the tide, limiting Fatimid rule to Egypt. The Fatimid dynasty finally ended in 1171 and overtaken by Saladin of the Ayyubid dynasty.