During the Third Partition of Poland, Sejny was annexed by the Kingdom of Prussia in 1795 and was made part of the newly established province of New East Prussia. Initially neglected, in 1807 the town became part of the short-lived Polish Duchy of Warsaw and a major administrative centre within the Łomża Department. After the defeat of Napoleon Bonaparte in 1815, the town became part of newly formed Congress Poland in the Russian Partition of Poland, retaining its status as a seat of a powiat within the Augustów Voivodeship. In 1818 the bishopric was moved to Sejny from Wigry and Sejny Priest Seminary was established in 1826. The town continued to prosper, despite a major fire that had struck the city earlier that year. The population also grew rapidly. Prosperity declined in the latter part of the 19th century.