religious, and political power and reorganised the army and the bureaucracy. After regaining control over the dissident governors, Abd-ar-Rahman III tried to conquer the remaining Christian kingdoms of the Iberian peninsula, attacking them several times and forcing them back beyond the Cantabrian Mountains. Abd-ar-Rahman's grandson later became a puppet in the hands of the great Vizier Almanzor (al-Mansur, "the victorious"). Almanzor waged several campaigns attacking and sacking Burgos, Leon, Pamplona, Barcelona, and Santiago de Compostela before his death in 1002. Taifas Between Almanzor's death and 1031, Al-Andalus suffered many civil wars, which ended in the division into the Taifa kingdoms. The taifas were small kingdoms, established by the city governors. The result was many (up to 34) small kingdoms, each centered upon its capital. Their governors had no larger-scale vision of the Moorish presence in the Iberian peninsula and had no qualms about attacking their neighbouring kingdoms whenever they could gain advantage by doing so. The split into the taifa states weakened the Islamic presence, and the Christian kingdoms further advanced as Alfonso VI of Leon and Castile conquered Toledo in 1085. Surrounded by enemies, taifa rulers sent a desperate appeal to the Berber chieftain Yusuf ibn Tashfin, leader of the Almoravids. Taifas reemerged when the Almoravid dynasty collapsed in the 1140s, and again when the Almohad Caliphate declined in the 1220s. Almoravids The Almoravids were a Muslim militia composed of Berbers, and unlike previous Muslim rulers, they were not so tolerant towards Christians and Jews. Their armies entered the Iberian peninsula on several occasions (1086, 1088, 1093) and defeated King Alfonso at the Battle of Sagrajas in 1086, but initially their purpose was to unite all the taifas into a single Almoravid Caliphate. Their actions halted the southward expansion of the Christian kingdoms. Their only defeat came at Valencia in 1094, due to the actions of El Cid. Meanwhile, Navarre lost all importance under King Sancho IV, for he lost Rioja to Sancho II of Castile, and nearly became the vassal of Aragon. At his death, the Navarrese chose as their king Sancho Ramírez, King of Aragon, who thus became Sancho V of Navarre and I of Aragon. Sancho Ramírez gained international recognition for Aragon, uniting it with Navarre and expanding the borders south, conquering Wasqat Huesca deep in the valleys in 1096 and building a fort, El Castellar, 25 km from Saraqustat Zaragoza. Catalonia came under intense pressure