 It was used as a royal residence by Peter IV of Aragón (1319-1387) and later, on the main floor, the reform was carried out that converted these rooms into the palace of the Catholic Monarchs in 1492.In 1593 it underwent another restructuring that would turn it into a military fortress, first according to Renaissance designs (which today can be seen in its surroundings, moat and gardens) and later for quartering military regiments.It underwent continuous restructuring and damage, especially with the Sieges of Zaragoza of the Peninsular War, until, unusually for historical buildings in Spain, it was finally restored in the second half of the 20th century.