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.