In the second half of the 9th century, the emir of Córdoba, Muhammad I (852–886), built a fortress on a promontory beside the river, the modern-day location of the Royal Palace.
Its purpose was to watch the passes of the Sierra de Guadarrama and to initiate raids against the northern Christian countries.
Many of the older buildings and monuments of the region known as El Madrid de los Austrias are from this period.
The Bourbon kings, especially Carlos III, fixated on converting Madrid into a great capital, using Paris as a model.
The reign of Isabella II saw the construction of the Congress of Deputies building, in Puerta del Sol.