 By 1373 the town had a mayor and in the early 15th century defensive walls were built.Then in 1418 it received new privileges from King Wenceslaus IV, which equated its town rights with those of Kłodzko and granted the title of a royal city.In the following decades, the town was devastated by Hussite troops in 1425 as well as by the Hungarian forces of king Matthias Corvinus in 1469.