Invasions had also resumed. Emir of Córdoba Abd al-Rahman III reunited Muslim Spain and brought the emirate to its zenith, transforming it into the caliphate of Córdoba in 929. During the 920s, he launched an offensive against the Christian kingdoms in northern Spain. In 920 one of Abd al-Rahman's armies crossed the Pyrenees, reaching Toulouse without capturing the city. Four years later, the Magyars launched a westward expedition and reached Toulouse before their defeat by Count Raymond III Pons. By the end of the 10th century, the Carolingian wars and subsequent invasions had left the county in disarray. Land was left uncultivated, and many farms were abandoned. Toulouse's proximity to Muslim Spain gave it a flow of knowledge and culture from the schools and printing houses of Córdoba, and it had retained more of the Roman legacy than northern France.