Medina Azahara (Arabic: مدينة الزهراء, romanized: Madīnat az-Zahrā, lit. 'the shining city') is the ruins of a vast, fortified Andalus palace-city built by Abd-ar-Rahman III (912–961), the first Umayyad Caliph of Córdoba, and located on the western outskirts of Córdoba, Spain. It was the de facto capital of al-Andalus as the heart of the administration and government was within its walls.
Built beginning in 936-940, the city included ceremonial reception halls, mosques, administrative and government offices, gardens, a mint, workshops, barracks, residences and baths. Water was supplied through aqueducts.
The main reason for its construction was politico-ideological: the dignity of the Caliph required the establishment of a new city, a symbol of his power, imitating other Eastern Caliphates. It was built in Córdoba because it had been the capital of the region (Betis) in Roman times; this made it easier for the Emirate and Caliphate of Cordoba to rule, while they existed, over al-Andalus. Above all, it demonstrated his superiority over his great rivals, the Fatimids of Ifriqiya in Northern Africa, as well as the Abbasids in Baghdad. Legend also says it was built as a tribute for the Caliph's favorite wife: Azahara. The complex was extended during the reign of Abd ar-Rahman III's son Al-Hakam II (r. 961–976), but after his death soon ceased to be the main residence of the Caliphs. In 1010 it was sacked in a civil war, and thereafter abandoned, with many elements re-used elsewhere. Its ruins were excavated starting from the 1910s. Only about 10 percent of the 112 hectares (0.43 sq mi) have been excavated and restored, but this area includes the central area, with "two caliphal residences, with associated bath complexes, two aristocratic residences, and service quarters ... spaces associated with the palace guard; some large administrative buildings ... the extraordinary court complex presided over by the reception hall ... the great garden spaces, and just outside this area, the congregational mosque".