alfonso now found himself dangerously isolated, with the right wing at some distance and the vanguard attacking the enemy camp. 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. 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.