The town gained significant profits from the trade. In 1627 the castle was refurbished and became a Baroque style palace of Bishop Jan Zadzik. By 1640 construction of water works and sewers had been completed. The town was annexed by the Kingdom of Prussia in 1772 through the First Partition of Poland. Part of the Duchy of Warsaw (1807–13) during the Napoleonic Wars, the town was again annexed by the Kingdom of Prussia after the dissolution of the duchy. In 1815 the palace was destroyed by a fire and in 1826 its walls were demolished. In 1820 the convent of the Benedictine Confederation was suppressed. In 1871 it became a part of the Prussian-led German Empire. During the Partitions of Poland, and until 1920 Löbau belonged to Kreis Löbau in the administrative district of Regierungsbezirk Marienwerder in the Province of West Prussia. According to the German census of 1890, the town had a population of 4,593, of which 2,300 (50.1%) were Poles.