Copenhagen was a trading and fishing center by the early 11th cent. It was fortified (1167) by Archbishop Absalon and was chartered (1254) by the bishop of Roskilde. The city was twice destroyed by the Hanseatic League but successfully resisted (1428) a third attack. Copenhagen replaced Roskilde as the Danish capital in 1443. The city exacted tolls from all ships passing through the Øresund until 1857. Having resisted (1658–59) a Swedish siege, Copenhagen was relieved by the Dutch. In 1660 peace between Denmark and Sweden was negotiated there. The city had expanded considerably in the 16th and 17th cent. as its trade grew, and it continued to develop in the 18th cent. as industries such as textile making and tobacco processing brought added prosperity.
Copenhagen became involved in the war between Napoleonic France and England in the early 19th cent. The news that Denmark, by a secret convention, was about to join Napoleon's Continental System and to join in the war on England led the British government to decide to send an expeditionary force to seize the Danish fleet, which already had been mauled (1801) in the battle of Copenhagen. When the Danes refused to surrender, the British landed troops in 1807 and severely damaged Copenhagen by bombarding it.
The city recovered quickly after the Napoleonic Wars, and its industrial base grew rapidly in the 19th cent. In World War II, Copenhagen was occupied (1940–45) by the Germans, and its shipyards were bombed by the Allies. The city itself was only slightly damaged, and it retained the charm and design that had resulted in its being called "the Paris of the North."