Tamim took over from his father al-Mu'izz ibn Badis (1016–1062) 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 (1063–1128). The capital, Mahdia, was attacked by the city-states of Genoa and Pisa in 1087 and forced to pay a high ransom - a sign of the growing dominance of Christian powers in the Mediterranean which also manifested itself in the Norman conquest of Sicily (1061–1062).