The Battle of Zallaqa
Yusuf ibn Tashfin, the Almoravid emir, crossed the sea to aid the kings of al-Andalus, and together with al-Muʿtamid ibn ʿAbbad met the army of Alfonso VI on the plain of Zallaqa near Badajoz, inflicting a crushing defeat that halted the Castilian advance for a whole generation.
When Toledo fell in 478 AH and Alfonso VI pressed the party-kings hard, they appealed to the commander of the Muslims Yusuf ibn Tashfin, lord of Marrakesh, and al-Muʿtamid ibn ʿAbbad spoke his immortal words: "Herding camels is better than herding swine."
Ibn Tashfin crossed with the Almoravid armies, al-Muʿtamid and the party-kings joined him, and the two hosts met on Friday 12 Rajab 479 AH (October 1086) on the plain of Zallaqa. al-Muʿtamid stood firm in the vanguard like a hero until wounds covered him.
Then Ibn Tashfin struck with his plan: he encircled the Castilian camp with his reserve divisions and drums that shook the earth, and Alfonso fled with a small, wounded remnant. Zallaqa delayed the fall of al-Andalus for centuries and prepared the way for the Almoravid state there.