join the Crown of the Kingdom of Poland under King Casimir IV Jagiellon. In 1454, upon the request of Confederation, King Casimir IV signed the act of incorporation of the region to the Polish Crown, and the townspeople took the castle and recognized the Polish king as the rightful ruler. Although the Teutonic Knights recaptured the city the following year, it was retaken by Polish troops in 1463. The Second Peace of Thorn in 1466 confirmed Allenstein as part of the Kingdom of Poland. Administratively it was located in the Prince-Bishopric of Warmia within the autonomous province of Royal Prussia and Greater Poland. Modern era From 1516 to 1521, Nicolaus Copernicus lived in the town castle as an administrator and then in Mehlsack (Melzak, now Pieniężno). Copernicus was in charge of the Polish defences in the Siege of Allenstein during the Polish-Teutonic War of 1519–21. He also started and managed the repopulation of the region, inviting a new wave of Polish settlers from Mazovia. The town along with Warmia then entered what is considered golden age of the region, when crafts and trade developed, thanks also to the city's location on the Warsaw-Königsberg trade route. During this period, the city was still visited several times by Copernicus, as well as leading figures of Polish Renaissance, writers, royal secretaries and diplomats: Johannes Dantiscus, called the "father of Polish diplomacy", and Marcin Kromer, who was also a historian and music theorist. St. James' Pro-Cathedral, one of the most distinctive landmarks of the cityscape, was completed at that time. Prosperity was halted in the 1620s, when the town suffered a fire and an epidemic. In 1626, during the Swedish invasion, clerics from Frauenburg (Frombork) took refuge in the town, which the Swedes did not reach. The city was sacked by Swedish troops later, in 1655 and 1708, during the next Polish-Swedish wars, and its population was nearly wiped out in 1710 by epidemics of the bubonic plague and cholera. The town became part of the Kingdom of Prussia in 1772 after the First Partition of Poland and its economy initially collapsed. Poles became subject to extensive Germanisation policies. A Prussian census recorded a population of 1,770 people, predominantly farmers, and Allenstein was administered within the newly created Province of East Prussia. On February 3 1807, the Battle of Allenstein took place. The French Army clashed with the Imperial Russian army. On that day,