Zirid dynasty
After the death of his father Buluggin ibn Ziri, al-Mansur ibn Buluggin (984–995), Hammad's brother, became the head of the Zirid dynasty in Ifriqiya, and installed Hammad as governor of the central Maghreb (grossly corresponding to the modern northern Algeria). He took on the Zanata tribes and eventually drove them into what is now modern-day Morocco. In 1007 Hammad founded the residence of al-Qala ("the Fortress") in the Hodna mountains west of Setif and embarked on an extensive building programme, which included a palace and mosque that became famous amongst contemporaries.