The first reference to the town of Brodnica dates from 1263. In 1285–1370 the construction of the Gothic Church of St. Catherine took place. Brodnica received town privileges in 1298. In 1440, the town was one of the founding members of the Prussian Confederation, which opposed Teutonic rule, and upon the request of which King Casimir IV Jagiellon reincorporated the territory to the Kingdom of Poland in 1454. In May 1454 the town pledged allegiance to the Polish King in Toruń. After the end of the Thirteen Years' War, the Teutonic Knights renounced claims to the town, and recognized it as part of Poland. It became a royal town of the Polish Crown, administratively located in the Chełmno Voivodeship. In the Teutonic state Brodnica was the seat of the Commander, in the Polish Kingdom it was the capital of the district starosty, and the former Commander's lands were then royal property.