Back in Magreb, Abu Hasan amassed his biggest army to undertake an invasion of Castile with the intention of undoing the previous century's Christian advances.
[12] With the addition of 27 ships hastily completed at Seville, the Christian fleets appeared in force in the Straits in October, cutting off the supply routes between Morocco and the Peninsula.
[4] Abu Hasan's position was now a difficult one, not only because the troops besieging Tarifa depended on supplies from Morocco, but also the Kingdom of Granada needed them, their forces having launched a series of limited attacks all along the frontier to hold the Castilians at bay.
On 10 October, a severe storm wrecked 12 Castilian galleys, and the same day the Sultan launched an all-out assault against Tarifa, which was barely repulsed with heavy losses on both sides.
[4] However, the officer commanding the light cavalry informed Abu Hasan that not a single Christian had managed to enter Tarifa during the night; whether he made his report in good faith, or in fear of admitting failure will never be known, but this misinformation had serious consequences the next day.
A Spanish contemporary chronicle estimated Abu Hasan's army at 40,000 knights and 400,000 infantry; figures regarded as grossly inflated by the historian Joseph O'Callaghan.
[1] The lowest figure is provided by Rodrigo Yánez's account, claiming that Abu Hasan deployed 60,000 men and that transporting the force across the Straits of Gibraltar took four months.
[4] The Castilian infantry consisted of municipal militias, stationed in the middle, and soldiers from Asturias and the Basque territories, who were armed and equipped with lances, crossbows, helmets, and shields and were located next to Afonso IV's knights.
The Castilian vanguard met serious resistance; de Lara was unable to cross the shallow river, but the King's natural sons Fernando and Fadrique led an 800-knight detachment towards the right and captured a small bridge, pushing back the 2,500 cavalry defending it.
[16] In the center, Juan Núñez de Lara and the Military Order of Santiago with 3,000 knights finally smashed through the enemy line and crossed too, riding hard up the hill where Abu Hasan's camp was clearly visible.
[17] Abu Hasan ordered a general attack and the Castilian King himself was about to engage in hand-to-hand combat when the Archbishop of Toledo, Gil Álvarez Carrillo de Albornoz, grabbed his reins and prevented it.
[17] The timely arrival of the Castilian rearguard balanced the situation, and when the forces which had been sacking the Sultan's camp advanced down the hill and engaged the enemy from the rear, Abu Hasan's surrounded army broke and fled towards Algeciras.
[17] The allied Castilian and Portuguese pursuit against the Muslims was ruthless, ending at the Guadamecí River, 6 km from the battlefield, although many remained in the hills, sacking the Sultan's rich camp.
[19] An attempt to recapture Gibraltar from the King of Granada was frustrated, however Castile had to settle for isolation of the citadel from the rest of Muslim territory when peace was agreed in 1350, after the death of Alfonso XI in his camp during the Great Plague.