Zirid dynasty
Badis ibn Mansur succeeded his father al-Mansur ibn Buluggin (984–995) as viceroy of Ifriqiya. He stayed very close to his overlords, the Fatimids of Egypt, on account of a power struggle amongst the Zirids - his right to rule was challenged by his great-uncle Zawi ibn Ziri, who was ultimately driven into Andalusia where he founded the Zirid dynasty of Granada (1012–1090).