The Abbasid caliphate fragmented in the 9th century. The Fatimids swept across North Africa, conquering the holy cities of Mecca and Medina.