 Complete the following phrase:  Tamim took over from his father al-Muizz ibn Badis 10161062 at a time when the Zirid realm found itself in a state of disintegration following the invasion of the Banu Hilal. Only the coastal towns were under control, and a reconquest of the hinterland from the Bedouin failed. Even on the coast the Zirids were not unchallenged - Tunis was lost to the Khurasanid dynasty 10631128. The capital, Mahdia, 