A parish church existed by 1282, while an Augustinian monastery was founded in 1290. From 1310 to 1329 the town experienced an economic boom linked to the grain trade, and received further market privileges. The town hall was built in 1320. Trade goods were shipped over the Oder and rivers. During the 13th and 14th centuries a defensive wall was built around the town with numerous towers and three city gates (, Barnkowo Gate, and Vierraden Gate — the latter demolished in the 19th century). In 1319 a war broke out over control of the region, and the town came again under control of the Duchy of Pomerania, but fell back to Brandenburg in 1324. In 1373, the region became part of the Czech Crown Lands, ruled by the Luxembourg dynasty. In 1402, the Luxembourgs reached an agreement with Poland in Kraków, according to which Poland was to purchase and re-incorporate the region, but eventually the Luxembourgs pawned it to the Teutonic Order. The and the new town hall (1410) built during this time were some of the most aesthetically pleasing Gothic buildings in the New March. The strong town withstood an attack by the Hussites in 1433 during the Hussite Wars. In 1454, the Teutonic Knights sold the region to Brandenburg in order to raise funds for war against Poland.