Cordoba's period of greatest glory began in the 8th century after the Moorish conquest, when some 300 mosques and innumerable palaces and public buildings were built to rival the splendours of Constantinople, Damascus and Baghdad. In the 13th century, under Ferdinand III, the Saint, Cordoba's Great Mosque was turned into a cathedral and new defensive structures, particularly the Alcázar de los Reyes Cristianos and the Torre Fortaleza de la Calahorra, were erected.
The site of Córdoba is determined by two geographical features - the mountains of the Sierra Morena, with their mineral wealth, and the river Guadalquivir, which skirts and then cuts through them. As such it is a natural site for human settlement, for reasons of trade and defence.Its early history is not known, but there was a flourishing Carthaginian township there in 206 BC, when it was captured by the Romans, who recognized its strategic and commercial importance and made it into the capital of the province of Hispania Inferior (Baetica). It was adorned with many fine public and private buildings and enclosed by imposing fortifications. Among its illustrious sons were the two Senecas and the poet Lucan.
With the onset of the barbarian invasions of the 6th century, Roman society on the Iberian Peninsula crumbled, and Córdoba fell to the Visigoths in 572. Despite the destruction wrought during this period, Córdoba retained its identity as a town throughout the Visigothic rule.
In 711 the town was one of the first to fall to the Moorish conquerors, led by Tarik-ibn-Zayid, after his great victory at the Battle of Guadalete. When Abd-al-Rahman I was deposed as Caliph of Damascus in 756 he set up his court at Córdoba and laid the foundations for the most glorious period of the city's history. He began building the Great Mosque in 786, on the site of a Roman temple of Janus which had been converted into a church by the Visigoths, with the intention of creating a structure that outshone the mosque of Damascus. Work on it continued over the two succeeding centuries.
At the same time Córdoba became the centre of a great realm renowned for its artistic and intellectual predominance and its liberal toleration of other religions. At its height the city is said to have enclosed over 300 mosques and innumerable palaces and public buildings, rivalling the splendours of Constantinople, Damascus, and Baghdad. The Caliphate of Córdoba collapsed after the bitter civil war of 1009-31, and only the Great Mosque survived as a symbol of its achievements. With the accession of power by the Ahnoravid and, subsequently, the Ahuohad dynasties in the 12th century Córdoba recovered much of its former glory, however, as capital of Al-Andalus. Its intellectual supremacy was assured by great scholars such as Averroes (Abu Walid-ibn-Rusch) and Maimonides (Musa-ibn-Maymun).
In 1236 the city was captured by Ferdinand III the Saint, and Córdoba entered the Christian world again. The Great Mosque became the Cathedral and new defensive structures were raised, among them the Alcazar de Los Reyes Cristianos (Fortress of the Christian Rings) and the Terre Fortaleza de la Calahorra, as befitted its role as a frontier town under constant threat of attack from the Moors.
With the re-establishment f Christian rule over the whole of the Iberian peninsula Córdoba lost much of its political and intellectual importance. It did, however, preserve an important commercial role, because of the proximity of the copper mines of the Sierra Morena.