After being ruled for many hundreds of years by the Viceroy of Sicily as part of the Spanish Empire, the Maltese islands were donated to the Order of St John by Charles I of Spain (who was also Emperor Charles V of the Holy Roman Empire). Charles decided to give the Knights of St John a home after they had lost Rhodes in 1522 to the Ottoman Turks of Sultan Suleiman the Magnificent. Malta still belonged to Spain but the Knights could rule over it as if it were nearly their own sovereign territory.
After taking some time to decide, the Order finally accepted Charles’ offer even though Malta and Gozo were quite poor and desolate. Grand Master L’Isle Adam led his Order to Malta and they arrived in 1530.
The Grand Master went to Mdina on 13 November 1530 and took the oath to observe the privileges and usages which had been granted by the King of Aragon more than a century before. At Mdina, being the capital city, the Order took possession of Malta where L’Isle Adam was given the silver key to the city by the Captain of the Rod (Capitano della verga). The Knights did not, however, make Mdina their headquarters and they instead settled in Birgu, near the Grand Harbour where their fleet was anchored.
On 11 January 1693 a strong earthquake hit Malta. Though no one died, many buildings were damaged and among the most severely hit there was the city of Mdina. Many buildings crumbled and one of these was the thirteenth century cathedral. It was soon rebuilt between 1697 and 1703.
In 1730 Grand Master Vilhena decided to build a Magisterial Palace in Mdina. It was built on the site where the Town Hall had stood. This was the place from where the local government or Universitas had directed the city and which had been built around 1454. Vilhena also beautified Mdina and brought it into the baroque age. The design was left in the able hands of Charles de Mondion.


