later ally himself with the kings of Pamplona and Asturias, and it was apparently he who raised the future Ordoño II of León at his court. The struggle for power within the Banu Qasi family came to a head in 882, when Muhammad fought, near Calahorra, a 7000-man force of his uncle Isma'il ibn Musa, and Isma'il ibn Furtun, a son of his uncle Furtun. In the following internecine squabbles, Furtun's four sons were killed and Isma'il ibn Musa was forced to retreat to Monzon. From there he rebuilt Lleida and routed an army sent by Wilfred of Barcelona. Muhammad ibn Lubb, now the clear head of the family, was left in control of the majority of the Banu Qasi lands. In 884, the emir sent two military campaigns into the region and took Zaragoza, although chronicler Ibn Hayyan reports that Muhammad ibn Lubb had sold the city to count Raymond I of Pallars and Ribagorza prior to its fall. This resulted in a consolidated Banu Qasi powerbase around Arnedo, Borja, Calahorra and Viguera, with Isma'il holding an enclave to the east, around Monzon and Lleida. In 885 and 886, Muhammad launched attacks against Castile, in the first apparently killing count Diego Rodríguez Porcelos, while the second was an attack on Álava in which many Christians were killed. The latter year also saw the death of emir Muhammad I of Córdoba. Muhammad ibn Lubb tested his power against the new emirs, and they responded by again trying to balance Banu Qasi power in the region, giving Zaragoza to the rival Tujibids, and Huesca to Muhammad ibn Abd al-Malik al-Tawil of the Muwallad Banu Shabrit clan. The latter was shortly challenged by Isma'il ibn Musa, whose sons fought a battle against al-Tawil's troops, Musa ibn Isma'il being killed and his brother Mutarrif captured. Isma'il died shortly thereafter, in 889, and al-Tawil and Muhammad ibn Lubb each took their case to emir Abd Allah for possession of Isma'il's lands, the emir confirming the succession of Muhammad ibn Lubb. There followed a period of relative peace and collaboration between Muhammad ibn Lubb and al-Tawil. In 891, Muhammad defeated a Christian force at Castro Sibiriano, but he dedicated most of his efforts in his final years against Tujibid Zaragoza, initiating what would become a 17-year siege. In 897, the citizens of Toledo rose up and offered their city to Muhammad, but being occupied with