Emperor Charles V handed over Malta and Gozo to the Order of St. John in 1530. The Order was in a state of perpetual war against the Ottoman Empire, which had expelled it from its previous base at Rhodes in 1522. At the time the Cittadella was still a medieval castle, and it provided refuge for the Gozitans during Ottoman or Barbary attacks. The largest attack on the Cittadella took place in July 1551, when a large Ottoman force, led by admiral Sinan Pasha, invaded Gozo and besieged the Cittadella. Governor Gelatian de Sessa offered terms of surrender, but they were refused, and the castle fell within a matter of days. The castle was then sacked, and most of the 6,000 Gozitans, who took refuge there, were taken as slaves. The attack left the castle in ruins, but it was rebuilt soon afterwards, although, initially, no efforts were made to modernize it.