Founded in the 1200s as Havelswerde by Havel of Lemberk, castellan of Duke Wenceslaus I, the town became royal in 1319 and walled in stone. The centuries were unkind: the Taborites took and robbed it in 1429, and in 1646 the imperial garrison of Kłodzko burned its own ally town to drive out the Swedes.
In 1779 the Austrians of Wurmser took the town in a single night, prisoners headed by a prince-general. The 20th century made it a film set more than once; today's visitors walk the walls, descend into two prison cells under the library, and visit the only museum of match collecting in Poland, a nod to the three match factories of the 1800s.