By 1806, the French had managed to conquer or make alliance with every major power on mainland Europe. This allowed Napoleon to launch his Continental System, an attempt to undermine Britain's economy by forbidding Europeans from trading with it.
At the start of the Napoleonic Wars (1803-15), Denmark was officially neutral. But its government came under increasing pressure from France and Russia to pledge its fleet to Napoleon. This would help secure the North Sea and Baltic Sea, and exclude British commercial shipping from Nordic ports.
Denmark's ships and crews were of high quality. In 1801, they had bitterly resisted - but eventually been defeated by - a British naval force at the First Battle of Copenhagen. This came after the Danes had joined Russian, Swedish and Prussian attempts to stop Royal Navy interference in Baltic trade (part of wider British efforts to weaken French commerce).
Despite this earlier defeat, the Danish fleet was still formidable in 1807. It included around 20 ships of the line, 17 frigates and many gunboats.
The prospect of this force falling into French hands alarmed the British. Not only could it help enforce the Continental System and pose a threat to British naval supremacy, Napoleon could also use it to support an invasion of Britain.
Initially, the British tried to persuade the Danes to hand over the fleet peacefully and sign a treaty of alliance. They promised that they would return the warships once the war with Napoleon was over.
At the same time, Napoleon was threatening to invade Denmark from the south unless it joined his war against Britain. To prevent this, most of the small Danish Army was manning defences in Schleswig-Holstein.
When the Danes refused to end their neutrality, the British decided to act. They despatched 400 ships and transports and over 25,000 sailors and soldiers under the command of Admiral James Gambier and General Sir William Cathcart.
The British task force reached Denmark in early August. A naval force then secured the waters around Zealand - the island on which Copenhagen is situated - to isolate the capital from the mainland and the neighbouring islands.
With most of Denmark's army defending its southern borders and unable to reach Zealand, the defence of the capital was left to 5,000 regulars and militia. This vastly outnumbered force faced three British infantry divisions and a cavalry brigade.
The British landed at Vedbaek, just north of Copenhagen, on 16 August. On 29 August, around 6,000 British troops under Major-General Sir Arthur Wellesley (the future Duke of Wellington) defeated a similar-sized Danish militia force near the town of Køge, to the south of the capital.
British casualties were 170 killed, wounded or captured. The Danes suffered over 150 killed and 200 wounded. In the days that followed, the British captured over 1,700 men.
Wellesley’s victory ensured that Copenhagen was completely encircled. When the Danes refused to surrender, the British fleet under Admiral Gambier, along with the Army’s gun and Congreve rocket batteries, proceeded to bombard the city. This lasted from 2 to 5 September, killing nearly 200 civilians and destroying many buildings.
On 7 September 1807, the Danes surrendered both the city and the fleet to the British. Many of the Danish ships were later added to the Royal Navy's strength.
This attack on a neutral country was heavily criticised internationally. But it succeeded in helping secure the North Sea and Baltic Sea for British naval and merchant ships.
Britain and Denmark remained at war for seven more years. Although there were several small naval clashes, there were no further land battles between the two nations. The Treaty of Kiel (1814) formally ended hostilities.