Абу Юсуф
Abu Yusuf and the Marinids returned to Spain in June 1277. Initially they were joined by the Banu Ashqilula and campaigned without Muhammad and the Nasrid forces. The Marinids defeated the Castilian forces outside Seville on 2 August and took several castles along the Guadalquivir river before retiring to Algeciras on 29 August. Abu Yusuf marched again on 30 October, this time joined by Muhammad near Archidona. They took the castle of Benamejí, encircled Córdoba and pillaged the surrounding towns. Either Alfonso or the towns affected by the war sued for peace, which was accepted by Muhammad and Abu Yusuf. Abu Yusuf retired to Algeciras on 28 November, concluded a truce on 24 February 1278, and returned to Morocco in May. Although the Marinids had won a battlefield victory and the Muslim forces plundered multiple towns, they failed to take any major settlement or permanently annex Christian territories. On the other hands, the ports of Tarifa and Algeciras on the Strait, remained as the Marinids' outposts in the peninsula.