During the Kościuszko Uprising, in 1794 the city was briefly recaptured by Poles, commanded by General Jan Henryk Dąbrowski. In 1807, after the defeat of Prussia by Napoleon and the signing of the Treaty of Tilsit, Bydgoszcz became part of the short-lived Polish Duchy of Warsaw. With Napoleon's defeat at the Battle of Nations in 1815, the town was re-annexed by Prussia as part of the Grand Duchy of Posen (Poznań), becoming the capital of the Bromberg Region. In 1871 the Province of Posen, along with the rest of the Kingdom of Prussia, became part of the newly formed German Empire. During German rule were demolished the oldest church of the city (church of Saint Giles), the remains of the castle, and the Carmelite church and monastery. In the mid-19th century, the arrival of the Prussian Eastern Railway ("Preußische Ostbahn") contributed greatly to the development of Bromberg. The first stretch, from Schneidemühl (Piła) to Bromberg, was opened in July 1851. The city grew from 12,900 in 1852 to 57,700 in 1910 – of whom 84 percent were German settlers and 16 percent indigenous Poles, all holding German citizenships. During World War I, Poles in Bydgoszcz formed secret organizations, preparing to regain control of the city in the event of Poland regaining independence. After the war, despite the town's German majority, Bromberg was assigned to the recreated Polish state by the 1919 Versailles Treaty. The handover of the city to Poland by Germany in 1920 was smooth, as German officials and military came from Germany and did not identify with the city, the soldiers were not willing to fight, and there were no ethnic conflicts among the inhabitants, who were focused on the hardships of life, including large unemployment and poverty, during the war. Now officially Bydgoszcz again, the city belonged to the Poznań Voivodeship. The local populace was required to acquire Polish citizenship or leave the country. This led to a drastic decline in ethnically German residents (German minority in Poland), whose number within the town decreased to 11,016 in 1926. In 1938, it was made part of the Polish Greater Pomerania. During the invasion of Poland, at the beginning of World War II, on September 1, 1939, Germany carried out air raids on the city.