 After Ibn al-Hajj’s death in 1114, the Almoravid Sultan appointed his brother-in-law Abu Bakr ʽAli ibn Ibrahim as-Sahrawi, known as Ibn Tifilwit, as the governor of the  province.[1]  The connection of Avempace to Ibn Tifilwit is well attested by al-Maqqari, Ibn al-Khatib (Ibn al-Khatib 1973, 412–417) and Ibn Khaqan. Avempace composed panegyrics for Ibn Tifilwit who rewarded him lavishly. The emir was living in the fortified palace of Al-Ja’fariyya and the construction was reminiscent of the castles in the Arabian desert, so that in a long poem Avempace refers to their days spent in Al-Mushaqqar, one of the fortresses often mentioned in pre-Islamic poetry (Ibn Khaqan 1989, 934–935). Avempace also wrote poems of the muwasshaha kind that pleased him, and they both enjoyed music and wine. Abu Bakr Ibn Tifilwit had nominated Avempace his vizier, and Avempace went to meet the deposed ‛Imad ad-Dawla Ibn Hud King in his castle apparently in a diplomatic mission, but he ended up in his jail for some months. Ibn Tifilwit died in 1116 in an operation against the Christians and Avempace composed moving elegies in his memory (Ibn Khaqan 1989: 937, 943).