The start of construction of the castle was parallel to that of the cathedral, although its duration was shorter. The replacement of the existing Andalusian buildings was carried out at the end of the 12th century or during the early years of the 13th century. Currently, this is the southeast nave and the southwest nave. The first was for housing, a meeting room and assemblies, while the second, crowned with a dome on the outside, a chapel and a place of worship.
It was during the second half of the 14th century when the castle's structure was set up and the different rooms were fully defined. At this time the northwest nave was added to the existing naves, intended to house the royal rooms and a new chapel. The northeast nave continued with defensive and storage functions.
The result of this process was that of a rectangular building consisting of four buildings around a central courtyard with a cistern. There were important economic contributions for its construction by various kings, including Peter the Catholic, James I the Conqueror and Peter III the Ceremonious.