The earliest settlement at the site of modern Madrid dates to the 9th century, when it was a Moorish stronghold called Magerit. King Alfonso VI of Castile reconquered it in 1083, and it became the capital of the Kingdom of Castile in 1561.
Under King Philip II in the 16th century, Madrid grew in importance as the royal court moved from Valladolid. It became a major cultural center, home to luminaries like Lope de Vega and Miguel de Cervantes.
In the 18th century, Madrid became the capital of a unified Spain. The 19th century saw the Spanish Civil War. Today, Madrid is a vibrant, cosmopolitan city of over 3.2 million people, the largest in Spain, and a major economic hub with many multinational corporations. It is also a top tourist destination, boasting the Royal Palace, the Prado Museum, and Retiro Park.