Saladin's brother Al-Adil rebuilt the citadel completely between 1203 and 1216 in response to the development of the counterweight trebuchet. After his death, power struggles broke out between the other Ayyubid princes and although Damascus switched hands several times, the citadel was taken by force only once, in 1239. The citadel remained in Ayyubid hands until the Mongols under their general Kitbuqa captured Damascus in 1260, thereby ending Ayyubid rule in Syria. After an unsuccessful revolt broke out in the citadel, the Mongols had most of it dismantled. After the defeat of the Mongols in 1260 by the Mamluks, who had succeeded the Ayyubids as rulers of Egypt, Damascus came under Mamluk rule. Except for brief periods in 1300 and 1401, when the Mongols conquered Damascus, the Mamluks controlled the citadel until 1516. In that year, Syria fell into the hands of the Ottoman Empire. Damascus surrendered without a fight and from the 17th century onward the citadel functioned as barracks for the Jannisaries—Ottoman infantry units. The citadel started to fall into disrepair in the 19th century and its last military use was in 1925, when French soldiers shelled the old city from the citadel in response to the Great Syrian Revolt against the French Mandate of Syria. The citadel continued to serve as a barracks and prison until 1986, when excavations and restorations started. As of 2011, excavation and restoration efforts are still ongoing.