Prehistory, antiquity and Roman foundation of the city
The first traces of human presence in the area are remains of a Neanderthal Man, dating to c. 42,000 to 35,000 BC. Pre-urban settlements around the mouth of the Guadalquivir river are known to have existed from the 8th century BC. The population gradually learned copper and silver metallurgy. The first historical mention of a settlement dates to the Carthaginian expansion across the Guadalquivir, when general Hamilcar Barca renamed it Kartuba, from Kart-Juba, meaning "the City of Juba", a Numidian commander who had died in a battle nearby. Córdoba was conquered by the Romans in 206 BC and named as Corduba.
In 169 Roman consul M. Claudius Marcellus, grandson of Marcus Claudius Marcellus, who had governed both Further and Hither Spain (Hispania Ulterior and Hispania Citerior, respectively), founded a Latin colony alongside the pre-existing Iberian settlement. Between 143 and 141 BC the town was besieged by Viriatus. A Roman forum is known to have existed in the city in 113 BC. The famous Cordoba Treasure, with mixed local and Roman artistic traditions, was buried in the city at this time; it is now in the British Museum.
It became a colonia with the title Patricia, between 46 and 45 BC. It was sacked by Caesar in 45 due to its Pompeian allegiance, and settled with veterans by Augustus. It became capital of Baetica and had a colonial and provincial forum and many temples. It was the chief center of Roman intellectual life in Hispania Ulterior (Further Spain). Its republican poets were succeeded by Seneca and Lucan.
At the time of Julius Caesar, Córdoba was the capital of the Roman province of Hispania Baetica. The great Roman philosopher Seneca the Younger, his father, the orator Seneca the Elder, and his nephew, the poet Lucan came from Roman Cordoba.
In the late Roman period, its bishop Hosius (Ossius) was the dominant figure of the western Church throughout the earlier 4th cent.
Later, it occupied an important place in the Provincia Hispaniae of the Byzantine Empire (552–572) and under the Visigoths, who conquered it in the late 6th century.
Córdoba was captured in 711 by the Umayyad army. Unlike other Iberian towns, no capitulation was signed and the position was taken by storm. Córdoba was in turn governed by direct Umayyad rule. The new Umayyad commanders established themselves within the city and in 716 it became a provincial capital, subordinate to the Caliphate of Damascus; in Arabic it was known as قرطبة (Qurṭuba).
Different areas were allocated for services in the Saint Vincent Church shared by Christians and Muslims, until construction of the Córdoba Mosque started on the same spot under Abd-ar-Rahman I. Abd al-Rahman allowed the Christians to rebuild their ruined churches and purchased the Christian half of the church of St Vincent. In May 766 Córdoba was chosen as the capital of the independent Umayyad emirate, later caliphate, of al-Andalus. By 800 the megacity of Cordoba supported over 200,000 residents, 0.1 per cent of the global population. During the apogee of the caliphate (1000 AD), Córdoba had a population of about 400,000 inhabitants, with estimates ranging from 100,000 to an unlikely 1,000,000. In the 10th and 11th centuries Córdoba was one of the most advanced cities in the world, and a great cultural, political, financial and economic centre. The Great Mosque of Córdoba dates back to this time. After a change of rulers the situation changed quickly. The vizier al-Mansur–the unofficial ruler of al-Andalus from 976 to 1002—burned most of the books on philosophy to please the Moorish clergy; most of the others were sold off or perished in the civil strife not long after.
Córdoba had a prosperous economy, with manufactured goods including leather, metal work, glazed tiles and textiles, and agricultural produce including a range of fruits, vegetables, herbs and spices, and materials such as cotton, flax and silk. It was also famous as a centre of learning, home to over 80 libraries and institutions of learning, with knowledge of medicine, mathematics, astronomy, botany far exceeding the rest of Europe at the time.
In 1002 Al-Mansur was returning to Córdoba from an expedition in the area of Rioja when he died. His death was the beginning of the end of Córdoba. Abd al-Malik al-Muzaffar, al-Mansur's older son, succeeded to his father’s authority, but he died in 1008, possibly assassinated. Sanchuelo, Abd al-Malik’s younger brother succeeded him. While Sanchuelo was away fighting Alfonso V of Leon, a revolution made Mohammed II al-Mahdi the Caliph. Sanchuelo sued for pardon but he was killed when he returned to Cardova. The slaves revolted against Mahdi, killed him in 1009, and replaced him with Hisham II in 1010. Hisham II kept a male harem and was forced out of office. In 1012 the Berbers "sacked Cardova." In 1016 the slaves captured Cardova and searched for Hisham II, but he had escaped to Asia. This event was followed by a fight for power until Hisham III, the last of the Umayyads, was routed from Córdoba in 1031.
After 1031, Córdoba lost its prosperity and fame and became an isolated city. The "ruling elite" were well known for their "disinterest in the outside world ... and intellectual laziness." 
A city map of Córdoba, Andalusia in 1851 (in Spanish)
During the process known as the Spanish Reconquista, Córdoba was captured by King Ferdinand III of Castile on 29 June 1236, after a siege of several months. The city was divided into 14 colaciones, and numerous new church buildings were added. The centre of the mosque was converted into a large Catholic cathedral.
The city declined, especially after Renaissance times. In the 18th century it was reduced to just 20,000 inhabitants. The population and economy started to increase again only in the early 20th century.
With the most extensive historical heritages in the world declared World Heritage Site by UNESCO (on 17 December 1984), the city also has a number of modern areas, including the districts of Zoco and the railway station district.
The regional government (the Junta de Andalucía) has for some time been studying the creation of a Córdoba Metropolitan Area that would comprise, in addition to the capital itself, the towns of Villafranca de Córdoba, Obejo, La Carlota, Villaharta, Villaviciosa, Almodóvar del Río and Guadalcázar. The combined population of such an area would be around 351,000. The Plano de Córdoba was also known for its books and how they created it.