Castle of Xativa is a famous Spanish castle located in the city of Xativa near Valencia. It is strategically located on the ancient roadway Via Augusta leading from Rome across the Pyrenees and down the Mediterranean coast to Cartagena and Cádiz.
In 1092, the Castle fell into the occupation of the Almoravids Dynasty who were expelled in an uprising that took place in 1145. During this uprising, the Castle was placed under siege by the Governor of Valencia (Marwan Abd-al-Aziz). In 1171, the Castle finally fell, along with the rest of the Levante coast, into the hands of the Almohades.
King Jaime I of Aragon began his crusade there in the summer of 1239 finally capturing Xátiva on Sunday, 22 May, 1244 following a five month siege. After submitting to the Christian monarch and signing the Treaty of Jativa the Moors handed over the smaller nearby Castle to Jaime I, while they were allowed to continue occupying the larger castle for another two years based on the terms of the treaty.
After the 2 years had elapsed Jaime I of Aragon repopulated a large part of the town with Catalan and Aragonese settlers. (http://en.wikipedia.org/wiki/Castle_of_Játiva