After the Livonian War, Bauska became part of the Duchy of Courland and Semigallia and prospered. The castle and city suffered heavily in the 17th and 18th centuries, under attacks from Sweden in the Polish-Swedish War and the Russians in the Great Northern War. In 1706, retreating Russian army blew up the castle. In 1711, an outbreak of plague ravaged Bauska, exterminating half of the population, and war returned once more in 1812, when Bauska, after short skirmishes, became one of Napoleon's army's transit points en route to Moscow.