Pengguna:Aans03/bak pasir
☁After he took the throne, he negotiated a treaty with Alfonso X of Castile, in which Castile agreed to end support for the Banu Ashqilula in exchange for payments. When Castile took the money but maintained its support for the Banu Ashqilula, Muhammad turned towards Abu Yusuf of the Marinids. The Marinids sent a successful expedition against Castile, but relations soured when the Marinids treated the Banu Ashqilula as Muhammad's equals. In 1279, through diplomatic manoeuvring, Muhammad regained Málaga, formerly the centre of Banu Ashqilula power. In 1280, his diplomacy backfired when Granada faced simultaneous attacks from Castile, the Marinids and the Banu Ashqilula. Attacked by his more powerful neighbours, Muhammad exploited the rift between Alfonso and his son Sancho, as well as receiving help from Volunteers of the Faith, soldiers recruited from North Africa. The threat subsided when Alfonso died in 1284 and Abu Yusuf in 1286; their successors (Sancho and Abu Yaqub, respectively) were preoccupied with domestic matters. In 1288 the Banu Ashqilula emigrated to North Africa at Abu Yaqub's invitation, removing Muhammad's biggest domestic concern. In 1292, Granada helped Castile take Tarifa from the Marinids on the understanding that the town would be traded to Granada, but Sancho reneged on the promise.