In the following years, the building became inadequate for the purposes of the royal court. Therefore, the court architect of King Sigismund I the Old, Benedykt Sandomierski erected a new residence, which was completed in 1519. The new residence was built in the Renaissance style in the shape of a residential tower on a square measuring 18 × 20 m (19.68 × 21.87 yd). The structure was crowned with a profusely decorated attic. In the 16th century, the castle was the site of frequent regional councils and synods. During the Deluge it was burned by Swedish-Brandenburgian troops. The reconstruction took place between 1668–1671 supervised by Michał Warszycki, sword-bearer of the Crown. The fortifications were not restored as well as the demolished attic, and the whole structure was crowned with a pavilion roof.