In the 14th century, the town gained its first fortified walls (still partly visible). In 1373 the town became part of the Lands of the Bohemian (Czech) Crown, ruled by the Luxembourg dynasty. In 1402, the Luxembourgs reached an agreement with Poland in Kraków. Poland was to buy and re-incorporate the region, but eventually the Luxembourgs sold it to the Teutonic Order. In 1454 the Teutonic Knights sold the town to the Margraviate of Brandenburg in order to raise funds for war with Poland. From 1701 it belonged to the Kingdom of Prussia and between 1871 and 1945 it was part of Germany. As a part of Germany, Barlinek was called Berlinchen. &lt;"Lasker: Move by Move", Location 543 of 7805, Kindle edition&gt;&lt;by Zenon Franco, Gloucester Publishers Limited, 2018&gt;From the 18th century onwards the town prospered as a centre of brewing and cloth manufacturing.