[2] The castle frequently changed hands between the Muslims (Arabs or Moors) and the European Christians until it was finally taken by Alfonso VI in 1085.
The Moors first took the castle until it surrendered briefly to Alfonso III of Asturias from 870 to 874 before it was retaken.
In 967, it came under the control of Al-Hakam II before being taken once again by the Christians under García Fernández of Castile until the arrival of Almanzor at the end of the 10th century.
After being taken by the Christian troops of Alfonso VI in 1085, it was enlarged on several occasions, maintaining its importance.
[4] Under John II, the Navarre troops occupied the castle with 250 horsemen, 500 foot soldiers and artillery.