Historic town developed in the 14th century from the outer bailey of a castle of the Teutonic Order of Knights. Its town rights were granted in 1723.