A fortress was constructed here between 860 and 880 AD. In the old days, when the city was under Moorish rule, it served to protect Toledo from Christians. Later, after the Christian reconquest of Spain, Madrid became the location of the Kings of Castile, and from the 14th century the building was established as the fortress Antiguo Alcázar. It was soon recognised as the royal residence in Madrid, a royal palace.