In the wake of the Polish-Lithuanian victory over the Order at Grunwald in 1410, the castle was occupied by Polish troops during the Thirteen Years' War. After the Second Peace of Toruń of 1466 it remained part of the Teutonic state, although under Polish suzerainty as a fiefdom. In the 15th century, a Catholic church was built, whose first parish priest became Mikołaj of Rzekwuj from the Płock land in Masovia.