When the
Caliphate of Cordoba broke up into the
Taifa kingdoms, the Berber mercenary
Abdallah ibn Muhammad ibn Maslamah ibn al-Aftas (1022–1045) took control of Badajoz, by death of
Sabur Al-Saqlabi, who was a
Slavic serf, previously serving at the court of
Caliph al-Hakam II, that had proclaimed himself Lord of Badajoz in 1009, and that Ibn al-Aftas served. Ibn al-Aftas added to his name the
Laqab al-Mansur Billah,
Victorious by Grace of God, and ruled over an extensive part of the
Al Garb Al Andalus, from the
Douro river to the south of
Tagus river, establishing the
Taifa of Badajoz. Ibn al-Aftas died in 1045. Under Ibn al-Aftas' successors,
Abu Bakr Muhammad ibn Abdallah al-Muzzaffar (1045–1065) and his two sons
'Umar ibn Muhammad al-Mutawakkil (1065–1094 in
Évora) and
Yahya ibn Muhammad al-Mansur (1065–1072 in Badajoz), the Taifa of Badajoz not only controlled large expanses of western Spain and Portugal, but was also a major centre of
Islamic culture, which was fostered by the Aftasid rulers. In 1055, Badajoz came under the suzerainty of the
Kingdom of León-
Castile and was forced to pay tribute. The taifa lost control over significant parts of its territory, south of the
Mondego river (south of
Coimbra). The
Abbadid dynasty of
Seville conquered parts of their territory. In 1094, the kingdom was annexed by the
Almoravid dynasty. Badajoz was taken at the end of 1095 by the Almoravid general Abu Bakr, with the connivance of the inhabitants who were fed up of the fiscal exactions of their emir, Umar ibn Muhammad al-Mutawakkil. Al-Mutawakkil and two of his sons Al-Fadl and S'ad, were taken prisoner and sent to Seville, but were executed before their arrival, which was eulogized in a poem by Ibn 'Abdun. Another son of Al-Mutawakkil, Al-Mansur, escaped and fortified himself for some time in the
castle of Montanchez, in the modern province of
Caceres, and finally together with his followers, migrated into the dominions of
Alfonso VI, where he abandoned
Islam for
Christianity. ==Aftasid rulers==