After the Order's defeat in the Battle of Grunwald on July 14, 1410, a Polish-Lithuanian army recaptured the town on November 5, 1410, but the Order regained the town in the First Peace of Thorn in 1411. In 1440 the town joined the Prussian Confederation, which opposed Teutonic rule, and at the request of which King Casimir IV Jagiellon signed the act of re-incorporation of the town and region to the Kingdom of Poland in 1454. The town became again part of Poland and Poles manned the castle. Tuchola became the seat of the local starosts, the first of which was . During the subsequent Thirteen Years' War, in 1464, a Polish-Teutonic battle was fought there, ending in a Polish victory. The Teutonic Order renounced claims to the town in the Second Peace of Thorn in 1466. Tuchola was a royal town of the Polish Crown, administratively part of the Pomeranian Voivodeship in the province of Royal Prussia in the larger Greater Poland Province. During the Swedish invasion of Poland (1655–1660), the town and the castle were besieged by the Swedes five times, but to no avail.