The palace is on the site of a 9th-century Alcaacute;zar, near the town of Majrit, constructed as an outpost by Muhammad I of Coacute;rdoba and inherited after 1036 by the independent Moorish Taifa of Toledo. After Madrid fell to Alfonso VI of Castile in 1083, the edifice was only rarely used by the kings of Castile. In 1329, King Alfonso XI of Castile convened the cortes of Madrid for the first time. Philip II moved his court to Madrid in 1561.
The old Alcaacute;zar (quot;Castlequot;) was built on the location in the 16th century. It burned 24 December 1734 and King Philip V ordered a new palace built on the same site. Construction spanned the years 1738 to 1755[4] and followed a Berniniesque design by Filippo Juvarra and Giovanni Battista Sacchetti in cooperation with Ventura Rodriacute;guez, Francesco Sabatini, and Martiacute;n Sarmiento. Charles III first occupied the new palace in 1764.Wikipedia