After the Umayyad caliphate fell in Damascus, the last surviving member fled to Iberia and established himself as the Emir of Cordoba in 756. He made Cordoba the capital and established the Umayyad emirate. For over two centuries, Córdoba flourished under the emirs and caliphs, becoming one of the most advanced cities in Europe with vast libraries, philosophical and scientific achievements, and a prosperous economy. However, internal struggles after the caliphate's collapse in 1031 led to the fragmentation of Al-Andalus into competing taifa kingdoms, weakening Muslim rule and allowing the Christian reconquista to gain ground.