 Ibn al-Imam and Avempace were friends for years; we have several letters that Avempace wrote to him on philosophical issues. Dunlop translated the beginning of an incomplete letter of Avempace to Ibn al-Imam in which Avempace refers to a treatise he composed during his second  imprisonment.[5]  As Ibn Khaqan reported, Avempace was imprisoned by Abu Ishaq Ibrahim ibn Yusuf Ibn Tashfin for a second time, after 1118 (Ibn Khaqan, 1989, p. 941).