The Khurasanid dynasty was founded by Abd al-Haqq ibn Abd al-Aziz ibn Khurasan, who was appointed as governor of Tunis by the Hammadids, after they were solicited by its inhabitants who complained about the Zirid sultan Al-Mu'izz ibn Badis, who didn't protect them from Hilalian attacks.