[1] The local wooden fort, that the records show existed as early as the 11th century,[2] was destroyed during the Tatar invasion in 1241 and subsequently rebuilt.
[1] During the reign of Casimir III the Great the castle received an upgrade from wooden fortress to a stone one.
It was the most westward fortification, and was meant to hold off any invasion coming to Lesser Poland from Bohemian or Silesian lands.
[3] In 1588, Maximilian III, Archduke of Austria, was held prisoner in here, after his defeat in the War of the Polish Succession (1587–1588).
[3] The fortress was periodically repaired, but due to shifts in the layout of the borders and relations between Poland and its neighbours, it lost much of its importance.