to the Thirty Years' War (1618–1648). In 1629, the Holy Roman Emperor Ferdinand II issued the Edict of Restitution, which restored the legal situation of 1552. However, the edict was revoked in April 1632, when Gustavus Adolphus of Sweden occupied Augsburg. In 1634, the Swedish army was defeated at the nearby Battle of Nördlingen. By October 1634, Catholic troops had surrounded Augsburg. The Swedish army refused to surrender and a siege ensued through the winter of 1634/35 and thousands died from hunger and disease. During the Swedish occupation and the siege by Catholic troops, the population of the city was reduced from about 70,000 to about 16,000. Diseases such as typhus and the plague ravaged the city. Guilds In the first half of the 17th century Augsburg was pivotal in the European network of goldsmiths. Augsburg attracted goldsmith journeymen from all over Europe and in the 18th century a large number of silversmiths and goldsmiths became master craftsman in Augsburg. Nine Years' War In 1686 the Holy Roman Emperor Leopold I formed the League of Augsburg, also known as the "Grand Alliance" after England joined in 1689. The coalition consisted at various times of Austria, Bavaria, Brandenburg, England, the Holy Roman Empire, the Electorate of the Palatinate, Portugal, Savoy, Saxony, Spain, Sweden, and the Dutch Republic. The coalition was formed to defend the Electorate of the Palatinate and fought against France in the Nine Years' War. End of Free Imperial City status The Reichsdeputationshauptschluss or the Final Recess of 1803, saw the annexation of nearly all of the 51 Free Imperial Cities, excepting Augsburg and five others. However, when the Holy Roman Empire was dissolved in 1806, Napoleon encouraged his German allies to mediatize their smaller neighbours, and Augsburg lost its independence. It was annexed to the Kingdom of Bavaria. In 1817, the city became an administrative capital of the Oberdonaukreis, then administrative capital in 1837 for the district Swabia and Neuburg. Industrial revolution During the end of the 19th century, Augsburg's textile industry again rose to prominence followed by the machine manufacturing industry. Second World War and Cold War Augsburg was historically a militarily important city due to its strategic location. During the German re-armament before the Second World War, the Wehrmacht enlarged Augsburg's one original Kaserne (barracks) to three: Somme Kaserne (housing Wehrmacht Artillerie-Regiment 27); Arras Kaserne (housing Wehrmacht Infanterie Regiment 27) and Panzerjäger Kaserne (housing Panzerabwehr-Abteilung 27