Scandinavia was divided during the Napoleonic Wars. Denmark-Norway tried to remain neutral but became involved in the conflict after British demands to turn over the navy. Britain thereafter attacked the Danish fleet at the battle of Copenhagen (1801) and bombarded the city during the second battle of Copenhagen (1807). Most of the Danish fleet was captured following the Second Battle of Copenhagen in 1807. The bombardment of Copenhagen led to an alliance with France and outright war with Britain, whose navy blockaded Denmark-Norway and severely impeded communication between the two kingdoms and caused a famine in Norway. Sweden, allied with Britain at the time, seized the opportunity to invade Norway in 1807 but was beaten back. The war with Britain was fought at sea in a series of battles, Battle of Zealand Point, Battle of Lyngør, and Battle of Anholt, by the remnants of the Danish fleet in the ensuing years, as the Danes tried to break the British blockade, in what became known as the Gunboat War. After the war, Denmark was forced to cede Heligoland to Britain.