The fortress and town was probably built by al-Fath ibn Musa ben Zennun circa the late 9th to early 10th century, becoming the al-Fath's main stronghold after his father's death in 908.[3] Having submitted to the Cordobese central authority by the 920s,[4] the rebellious Banu Zennun (later arabised to 'Dhi-l Nun') clan was removed from the place by 936, although Uclés returned to their control in 1018.[3]
Towards 1157, the fortress of Uclés was acquired in a barter by Alfonso VII from Ibn Mardanix in exchange for the fortress of Alicún.[6] The fortress was ceded to the Order of Saint John of Jerusalem in 1163,[7] and, following the unsuccessful repopulating efforts by the Knights Hospitallers,[7] to the Order of Santiago on 9 January 1174.[8] The Order's grip in the area consolidated following the 1177 takeover of Cuenca and Uclés was granted a fuero by the order's Grand Master in 1179, henceforth becoming the seat of an encomienda and the headquarters of the order in the Kingdom of Castile.[9]