led by Alfonso himself and accompanied by the Infantes Sancho, Peter and John. They defeated Muhammad in a battle near Granada's walls on 25 June, but after the failure of the negotiations that followed, the Castilians left Granada. At the end of 1281, Alfonso sent Sancho to Granada for further negotiations and Muhammad agreed to renew his vassalage to Castile. However, Alfonso accused Sancho of acting treacherously and of appropriating Muhammad's tribute. A rift broke out between the king and his son, which weakened the Castilian threat to Granada. Alfonso ended up asking for Abu Yusuf's help against Sancho, and the two monarchs campaigned together against Sancho's partisans in Castile. Meanwhile, Muhammad sealed an alliance with Sancho at Priego in late 1282. At the end of 1283, Abu Yusuf attacked Málaga, forcing Muhammad to sue for peace. Mediated by Abu Yusuf's son, Abu Yaqub Yusuf, they agreed to reconcile and attack the Christians together. Alfonso died in 1284, and was succeeded by Sancho. Sancho was friendly towards Granada and pulled back the Castilian troops, while Muhammad declared his vassalage to him. In 1286 Abu Yusuf died and was succeeded by his son Abu Yaqub. At the beginning of his reign Abu Yaqub was more preoccupied with domestic affairs, and so withdrew his forces from the Iberian campaign. In 1288 Abu Yaqub offered the Banu Ashqilula lands in North Africa. The clan took up the offer and emigrated en masse from Granadan territory. Tarifa campaigns The Marinids retained outposts in Iberia, including Tarifa, an important port town on the Strait of Gibraltar. In 1290, Muhammad came to an arrangement with Sancho and the ruler of Tlemcen. Castile would attack Tarifa, Granada would attack other Marinid possessions, and Tlemcen would open hostilities against the Marinids in North Africa. According to the agreement, Castile would then hand Tarifa to Granada in exchange for six border fortresses. In November and December 1291, James II of Aragon met Sancho and agreed to join the war against the Marinids. In October 1292 Castile, with assistance from Aragon's navy and supplied by Granada, succeeded in taking Tarifa. Castile also took the six border fortresses from Granada as agreed, but refused to cede Tarifa even after Muhammad met with Sancho in Córdoba in December. Granada, feeling cheated, then switched sides to the Marinids. Muhammad travelled to North Africa and met Abu Ya'qub at Tangier on 24 October, bearing