Frustrated by Alfonso, Muhammad sought help from the Marinids, ruled by Abu Yusuf Yaqub. While Alfonso was away on a journey to meet Pope Gregory X, leaving his realm under his heir and the regent Ferdinand de la Cerda, Muhammad sent envoys to the Marinid court. Abu Yusuf had expressed interest in fighting the Christians in Spain since 1245, and now, having gained control of the former Almohad capital of Marrakech and unified most of Morocco, he had the power and the opportunity to do so. In April 1275 Abu Yusuf mobilised an army which included 5,000 cavalry under the command of his son, Abu Zayyan Mandil. Three months later Abu Zayyan crossed the Strait of Gibraltar, landed at Tarifa and took over the town. Soon the governor of Algeciras seceded from Granada and yielded his town to Abu Zayyan. The Marinid prince established a beachhead between Tarifa and Algeciras, and began raiding Castilian territory up to Jerez. Amid the landings, Muhammad II attacked the Banu Ashqilula in Málaga on June 1275, but he was repulsed. Ferdinand de la Cerda marched to meet the Muslim forces, but he died on 25 July 1275 in Villareal, leaving Castile with uncertain leadership.