Denmark tried but failed to regain control of Scania in the Scanian War (1675–1679). After the Great Northern War (1700–21), Denmark managed to regain control of the parts of Schleswig and Holstein ruled by the house of Holstein-Gottorp in the 1720 Treaty of Frederiksborg and the 1773 Treaty of Tsarskoye Selo, respectively. Denmark prospered greatly in the last decades of the 18th century due to its neutral status allowing it to trade with both sides in the many contemporary wars. In the Napoleonic Wars, Denmark traded with both France and the United Kingdom and joined the League of Armed Neutrality with Russia, Sweden, and Prussia. The British considered this a hostile act and attacked Copenhagen in 1801 and 1807, in one case carrying off the Danish fleet, in the other, burning large parts of the Danish capital. This led to the so-called Danish-British Gunboat War. British control of the waterways between Denmark and Norway proved disastrous to the union's economy and in 1813 Denmark–Norway went bankrupt.