It was briefly occupied by the Teutonic Knights in 1339 before reverting to Poland. In 1359 it received municipal rights from Archbishop Jarosław. Shortly after a defensive castle was built which survived until 1721.
The town was occupied by the Teutonic Knights for a short period in 1339 before being returned to Polish control. Later, in 1359, it gained municipal status under the authority of Archbishop Jarosław. A defensive stronghold was erected soon after, which stood until 1721.