The first castle was constructed in the 13th C on the south impel of Castle Hill. Its purpose was to offer protection from attacks by Mongols and Tartars. Under King Karl Robert a smaller fortress was built. King Sigismund, who made Buda his house, had a Gothic castle erected, which was significantly extended, in Renaissance style, under Matthias Corvinus. Even though the Castle Palace (Vár-palota) endured during the time of Turkish occupation, it was nonetheless almost totally ruined during the Siege of 1686. Consequently, in the 18th C, a new castle was constructed, which in the time of the Empress Maria Theresa had more than 200 rooms.