The king’s worst defeat came next—the massacre of his rear guard at Roncevalles—which ironically became the basis of later legends that sang of Charlemagne and Roland as the most heroic Christian knights since King Arthur.
In 777, Saracen envoys came to Charlemagne to beg him to help their masters, who had been cornered in the Iberian Peninsula by the Emir of Cordoba, Abd ar-Rahman I, and they offered their homage in exchange for military support. Charlemagne saw it as a chance to take advantage of Islamic turmoil and extend his kingdom, and possibly Christendom itself. He must have also seen the Saxons as being conquered (and they were, temporarily), so he agreed and set off for Spain. Putting together an army of Neustrians, Austrasians, Lombards, and Burgundians, Charlemagne went over the Pyrenees in 778 and defeated the already weakened Basque city of Pamplona before going on to Zaragoza. The Basques, who had already had their fill of Muslim invaders, did not appreciate being used as target practice by the Franks, and they plotted revenge.
When he got to Zaragoza, Charlemagne was told that his Muslim allies had broken away from each other. Sulaiman had been assassinated, and the caliph’s huge forces were marching straight for Charlemagne’s army, sweeping the rebels away with every step. The king was a great warrior, but he was also no fool—he beat a retreat.
It was while he was making his way through the pass of Roncesvalles that the Basques attacked, separating his rear guard and baggage train. They massacred the rear guard, including one of the king’s relatives and friends—a man named Hruodland, known today as Roland, the ruler of the Breton March. Whether Roland was actually a relative, an illegitimate son, or merely a friend of Charlemagne is unknown, but the Frankish bards seemed to believe the story would be better if he were a relative. They also made the battle not against the Christian Basques but against the Saracens in order to turn Roland into a Christian martyr, and they painted the king as a glorious King Arthur-like character, with the legendary sword Joyeuse in hand and surrounded by elite (possibly cavalry) bodyguards.
The battle was disastrous for Charlemagne, but only in the short term, as the defeat did not undermine his position in Francia as a great warlord. It also helped that he and his military barons were immediately involved in a new war with the Saxons, and the border remained stable because the Moorish caliphs were too busy killing each other to think about trying to cross into Frankish lands.