In 1009, Córdoba was the seat of a caliphate that stretched across most of the Iberian Peninsula, with a court, a mint, and a library that drew scholars from across the Mediterranean. By 1031, the caliphate no longer existed. Its collapse wasn't a single invasion or a foreign conquest — it was a civil war, fought mostly by Córdobans and the mercenaries their own rulers had hired, and it ended with the city's great palace-complex outside town burned and abandoned. Understanding how that happened explains most of what you now see, and don't see, when you visit.
A caliphate built on one man's authority
The title itself was new. Abd al-Rahman III declared himself caliph in 929, breaking with Baghdad and claiming religious as well as political authority over al-Andalus. That declaration papered over a real weakness: the Umayyad dynasty in Córdoba had no deep well of legitimacy to draw on, only the personal authority of whoever held the throne. For two generations that was enough. Abd al-Rahman III and his son al-Hakam II were capable, long-reigning rulers, and the state they ran — expanding the Mezquita, building the palace-city of Medina Azahara, running an administration that taxed and governed effectively — looked stable from the outside.
It wasn't. When al-Hakam II died in 976, his heir, Hisham II, was a child. Power passed not to a regency council but to a single administrator, Abu Amir al-Mansur (Almanzor to Spanish historians), who ruled in the boy-caliph's name for over two decades, fought successful campaigns into the Christian north, and built himself a rival palace complex, Madinat al-Zahira, east of the city. Almanzor was effective. He was also, in retrospect, the man who hollowed out the system he ran. He kept Hisham II alive but powerless, concentrated military command in his own family, and relied heavily on Berber troops recruited from North Africa rather than on the old Arab and Andalusi aristocracy. When he died in 1002, that whole arrangement depended entirely on his sons being as capable as he was.
They weren't, for long. Almanzor's son Abd al-Malik held things together for a few years. His successor, Sanchuelo, overreached: he had himself named heir to the caliphate itself, something that threatened both the Umayyad family's claim to the title and the factions who had tolerated Almanzor's son only as a regent, not a successor. Sanchuelo left Córdoba on campaign in 1008; while he was away, the city rose against him.
Twenty-two years, at least ten claimants
What followed is usually called the fitna, an Arabic word for civil discord, and it is the right word: this was not one war but a sequence of coups, depositions, and reinstatements, with Córdoba itself changing hands repeatedly. Hisham II was briefly restored, then deposed again. A great-grandson of Abd al-Rahman III, Muhammad II al-Mahdi, seized the throne with the backing of the city's elites against the Berber garrisons Almanzor had relied on — and then found those same Berber troops marching on the city in revenge. Berber forces besieged and took Córdoba in 1010 and again in subsequent rounds of fighting; rival claimants backed by Slavic palace guards, by Berber commanders, and by Christian mercenary contingents from the northern kingdoms all took turns holding the title and losing it. At least ten men claimed the caliphate between 1009 and 1031, some of them more than once.
⚠️ If you read a plaque or a guidebook that names a tidy sequence of "caliphs" for this period as though it were an orderly succession, treat it with some skepticism — contemporary chroniclers themselves disagreed about who controlled what, and for how long.
The fighting fell heavily on Medina Azahara. Berber troops sacked the palace-city during the 1010 siege, and it was never restored as a seat of government; what you can walk through today at Medina Azahara is largely the result of that abandonment, followed by centuries of stone-robbing for other buildings, followed by twentieth-century excavation. ⭐ Go to the site museum before the ruins themselves — the models there make sense of a footprint that's otherwise hard to read as you walk it, with no reconstructed roofs and few labeled walls.
What actually ended, and what didn't
The caliphate was formally abolished in 1031, when Córdoba's notables deposed the last claimant and declared a return to rule by a council of leading citizens rather than a single dynastic ruler. Al-Andalus did not disappear; it fragmented into roughly two dozen independent city-states, the taifas — Seville, Granada, Zaragoza, Toledo, and others — each ruled by its own king or faction, some Arab, some Berber, some, in Granada's case, of Jewish-descended advisors serving a Berber dynasty. Culturally, several taifa courts were arguably richer patrons of poetry and scholarship than the caliphate's final decades had been; politically, they were far weaker, and it was this fragmentation, more than any single battle, that opened the door to Christian kingdoms expanding south over the following two centuries.
Córdoba itself became a taifa in its own right for a time, then was absorbed by stronger neighbors, and its population and importance shrank relative to Seville. The physical city, though, kept functioning. The Mezquita remained in use and was never seriously damaged in the fitna's fighting, since the violence centered on palaces and garrisons, not the congregational mosque. The Caliphal Baths near the Alcázar date from this general era and give a more intimate, human-scale sense of daily life under caliphal rule than the ruined grandeur of Medina Azahara does. The Museo Arqueológico holds objects — capitals, inscriptions, ivories — pulled from the wreckage of this period that put faces, in a sense, on a conflict that mostly survives in chronicle fragments.
What's worth carrying away from this history, walking around modern Córdoba, is how fast it happened. A state that had looked permanent — minting its own coinage, receiving embassies from Byzantium and Germany, running one of the most sophisticated administrations in Europe — came apart within a single generation, undone less by outside enemies than by a succession crisis no one had planned for. The ruins at Medina Azahara and the quieter stonework of the Caliphal Baths are both, in their way, monuments to that speed. For context on what came immediately before this collapse, see al-Andalus; for a walking route that connects these caliphal-era sites in one day, check itineraries, and for the excursion out to Medina Azahara itself, including transport options, see day trips.
In pictures

