The area that Madrid now stands on was inhabited in prehistoric times and there is evidence of a Roman settlement nearby dating back to the 4th century. The real founding of Madrid, though, came courtesy of Muhammad I of Cordoba in 9th century, who built a castle on the site of the present-day Palacio Real.
In the 11th century, the Christians took Madrid from the Moors, turning the mosque into a cathedral, and in the 14th century, Ferdinand IV of Castile sowed the seeds of the Spanish parliament here. During the Spanish Inquisition that took hold in 15th century, Jews and Moors were persecuted and eventually expelled from the city.
Charles I of Spain moved the court to Madrid in 1561, and the city became the Spanish capital. By the 17th century, it had become wealthy, with money pouring in via the now vast Spanish Empire. The Siglo de Oro, or Golden Century, had arrived and the population increased dramatically.
Madrid was greatly modernised in the 18th century, with new city gates, bridges and buildings springing up. The Palacio Real was constructed next to the large Plaza de Oriente square on the site of the ruins of the Alcazar (the old Moorish castle, destroyed by fire in 1734).
In the early 19th century, Napoleon seized control of the country. After his defeat, Spain saw a period of decline leading up to the formation of the short-lived First Spanish Republic.
The Second Spanish Republic came in 1931 and culminated in 1936 with the Spanish Civil War, during which Madrid was damaged heavily. In 1939, General Franco assumed control of the country. The city was greatly expanded and industrialised, while Spain was massively centralised around Madrid.
After Franco’s death in 1975, his named successor, King Juan Carlos I, helped guide the country back to democracy. As Spain opened up to the world after decades of repressive dictatorship, Madrid became a centre of counterculture with boldly liberal art, music and film. In spite of the eurozone crisis that hit Spain in 2009, Madrid maintains this dynamic outlook today.
Did you know?
• During the Spanish Civil War, Madrid became the first European city to be bombed from the skies.
• Lying in the very heart of Spain, Madrid might seem an ideally based capital, but the Moors probably first built a citadel here to defend the long-time capital, Toledo.
• The city became one of the main centres for art in 16th and 17th centuries, boasting painters like Velazquez and El Greco. Cervantes’ Don Quixote was also first published here in early 17th century.