The siege of Niemcza (Polish: Obrona Niemczy) took place during three weeks in August 1017, in the last phase of the German–Polish War (1002–18), when the forces of the Emperor Henry II besieged the town of Niemcza controlled by the Polish ruler Bolesław I the Brave. Despite the aid of Bohemian and Lutici allies, the Imperial attack was ultimately unsuccessful, according to medieval chronicler Thietmar of Merseburg due to the arrival of reinforcements which managed to break into the city and the illness among the German forces. The failure of the siege marked the end of Henry's campaign in Poland and led the emperor to agree to the Peace of Bautzen in 1018, which left the eastern March of Lusatia and the Milceni lands (later Upper Lusatia) under Polish control.