 In the mid-11th century, the Hammudids lost control of their Iberian possessions, but retained a small taifa kingdom based in Ceuta.In 1083, Yusuf ibn Tashufin conquered Ceuta.In the same year, al-Mutamid, king of the Sevilla taifa, traveled to Morocco to appeal to Yusuf for help against King Alfonso VI of Castile.