This struggle persisted for years until Al-Mamun ibn Dhul-Nun, the ruler of Toledo, allied with Ferdinand I, the King of León and Castile, which enabled him to capture Valencia.
[15] The Taifa of Zaragoza soon faced the same threat that had befallen Toledo, prompting most Muslim rulers in Al-Andalus to conclude that there was no refuge from Alfonso except by seeking the help of the Almoravids in North Africa.
These Christian rulers, after years of internal conflicts, united with the goal of decisively eliminating the Islamic presence in the Iberian Peninsula, especially following the fall of Toledo.
[17] The Almoravids, originally referred to as the "Masked Ones," were the foundation of an Islamic reform movement that emerged from the call of Sheikh Abdallah ibn Yasin and the influence of the Sanhaja tribes, particularly the Lamtuna and Judala.
Through these efforts, Yusuf ibn Tashfin established control over the Maghreb, extending his dominion from the territories of the Banu Mazghena in Algeria to Tangier, the far reaches of Sous, and into the Gold Mountains of Sudan.
These Andalusian emissaries sought the assistance of the Almoravids, believing that Marrakesh, under the leadership of Yusuf ibn Tashfin, could provide the military and political support needed to improve their deteriorating conditions and counter the growing threat from the Christian forces in the north.
Al-Mu'tamid ibn Abbad, the Emir of Seville, found himself distracted by one of his numerous wars, causing him to miss the payment of tribute to Alfonso VI, King of Castile.
In response to this escalating pressure, in 475 AH (1082 AD), Al-Mu'tamid wrote to Yusuf ibn Tashfin, describing the dire situation in Al-Andalus and the worsening state of the Muslims, as Christian forces had taken control of much of their territory.
[29] As news of the murder of Alfonso VI's minister spread, the people of Al-Andalus recognized the seriousness of their predicament, especially given the inability of the Taifa kings to fend off the growing threat from the Christian kingdoms.
Subsequently, the Almoravid contingents set sail across the sea towards Al-Andalus, chanting praises and accompanied by groups of fighters who had joined them following Ibn Tashfin's call to jihad.
Ibn Al-Kurdubus noted, “He sincerely dedicated his intentions to God, filled the sea with fleets, and allowed groups to cross one after another, occupying Al-Jazira Al-Khadra with his green battalion, which included twelve thousand riders from the elite of the troops.”[41][42] When Yusuf ibn Tashfin boarded the ship bound for Al-Andalus, he prayed, “O Allah, if you know that my crossing is for the good and welfare of the Muslims, make my passage across this sea easy.
If not, then make it difficult for me so that I do not cross.”[43] He also ordered the transportation of camels from Morocco to Al-Andalus for military purposes, causing the desert to fill with their numbers and the sound of their grunting rising to the heavens.
In response, Ibn Tashfin ordered the fortification of Al-Jazira Al-Khadra, stockpiling weapons, ammunition, and food, while reinforcing its defenses to serve as a stronghold and secure point of contact between Al-Andalus and Morocco.
The poet Al-Hamiri noted, “He ordered the citizens to bring food and hospitality, and Yusuf was pleased and energized by this.”[46][47] Al-Mu'tamid then commanded his troops to prepare for battle alongside the mujahideen.
He was impressed by the sight of their numbers and the gleam of their armor, remarking to his cousin Garcia, “Today we shall achieve victory over the Muslims.”[54] Alfonso continued his march towards Batalyaws, where the plain of Zalaqa and the Muslim army awaited him.
[63][64] On the Castilian side, after the arrival of volunteers from southern France, Italy, and various regions including Aragon, Galicia, Asturias, and Biscay, Alfonso VI assembled his forces and formulated a military strategy.
However, the German historian Joseph Aschbach noted that "Alfonso believed, based on a vile principle, that he was entitled to resort to any deception in war and to break a sworn pact," intending to surprise the enemy by attacking before the agreed-upon day.
On the morning of Friday, the 12th of Rajab 479 AH (October 23, 1086), the scouts returned to inform Al-Mu'tamid that they had heard the sounds of the armies and the clatter of weapons, confirming that Alfonso was mobilizing his forces.
He also sent a message to Al-Ma'izz ibn Badis, updating him on the situation: "News reached us in the early hours of Friday that the enemy had targeted the Muslims, believing he had seized an opportunity.
[68] However, the Castilian army encountered the Almoravid forces, composed of ten thousand knights under the command of Dawud ibn Aisha, before reaching the Andalusian camp.
[70] Alfonso VI sensed an impending victory as he observed the weakening resistance of Al-Mu'tamid ibn Abbad against his relentless assaults and noted the growing retreat among the Muslims of Andalusia.
However, the Almoravid army, led by Yusuf ibn Tashfin, remained concealed behind a high mound, shielded from the enemy's view, with only ten thousand fighters having joined Al-Mu'tamid.
[78] As the sun began to set and realizing defeat was imminent, Alfonso retreated with a small contingent to a nearby hill and later escaped under the cover of darkness, eventually fleeing to Coria.
Historian Muhammad ibn al-Samak al-Amili likened it to past Islamic victories, stating: "It was a day unmatched since Yarmouk and Qadisiyyah, a triumph that solidified the foundations of religion after they had been slipping, and restored the light of truth to its brilliance."
Ibn Buluggin recorded that "after the campaign ended, he gathered us, the rulers of Al-Andalus, and ordered us to unite and form a single front, reminding us that the Christians only preyed on us because of our division and mutual reliance on them.
Alfonso VI, reassured by Yusuf ibn Tashfin's return to Morocco, sought support from Christian kingdoms and European principalities to rebuild his forces.
"[97] Despite his entreaties, the Taifa leaders reverted to their previous divisions and hostilities, allowing Alfonso VI to resume his raids and send envoys demanding tribute from the princes.
This lack of support forced Ibn Tashfin to lift the siege of Toledo due to insufficient provisions, leading to growing resentment toward the Taifa rulers, particularly the emir of Granada.
[101] A number of scholars and jurists issued a fatwa directed at Yusuf ibn Tashfin regarding the status of the Taifa leaders, stating: “It is not permissible to obey them, nor is their rule valid, as they are corrupt.
[104] Within eighteen months, the Almoravids managed to conquer all the major cities of Al-Andalus, including Granada, Málaga, Jaén, Córdoba, Seville, Almería, Valencia, Badajoz, and the Balearic Islands.