After the first four caliphs ( Abu Bakr , Umar ibn al-Khattab , Uthman ibn Affan , and Ali ibn Abi Talib ) , the title was used by the Umayyads , the Abbasids , and the Ottomans , as well as by other dynasties in Southern Pakistan , Spain , Northern Africa , and Egypt . After the first four caliphs ( Abu Bakr , Umar ibn al-Khattab , Uthman ibn Affan , and Ali ibn Abi Talib ) , the title was claimed by the Umayyads , the Abbasids , the Fatimids , and the Ottomans , and at times , by competing dynasties in Spain , Northern Africa , and Egypt .