The palace was originally built by Muhammad I Umayyad Emir of Cordoba, and he used it as an outpost during his reign. Eventually, King Henry III revamped it by adding towers as it was used for defensive activities too. Later, his son used the palace as his royal residence. After Philip II came into being, he made Madrid the capital of Spain and decided to renovate the entire palace.