The Danes probably settled Jutland by c.10,000 B.C. and later (2d millennium B.C.) developed a Bronze Age culture there. However, little is known of Danish history before the age of the Vikings (9th–11th cent. A.D.), when the Danes had an important role in the Viking (or Norse) raids on Western Europe and were prominent among the invaders of England who were opposed by King Alfred (reigned 871–99) and his successors. St. Ansgar (801–65) helped convert the Danes to Christianity; Harold Bluetooth (d. c.985) was the first Christian king of Denmark. His son, Sweyn (reigned c.986–1014), conquered England. From 1018 to 1035, Denmark, England, and Norway were united under King Canute (Knut). The southern part of Sweden (Skåne, Halland, and Blekinge) was, with brief interruptions, part of Denmark until 1658.
After Canute's death, Denmark fell into a period of turmoil and civil war. Later, Waldemar I (reigned 1157–82) and Waldemar II (reigned 1202–41) were energetic rulers who established Danish hegemony over N Europe. With the end of the Viking raids and the development of a strong and independent church, the nobles were able to impose their will on the weaker kings. In 1282, Eric V (reigned 1259–86) was forced to submit to the Great Charter, which established annual parliaments and a council of nobles who shared the king's power. This form of government persisted until 1660.
Waldemar IV (reigned 1340–75) again brought Danish power to a high point, but he was humiliated by the Hanseatic League in the Treaty of Stralsund (1370). Waldemar's daughter, Queen Margaret, achieved (1397) the union of the Danish, Norwegian, and Swedish crowns in her person (see Kalmar Union). Sweden soon escaped effective Danish rule, and with the accession (1523) of Gustavus I of Sweden the union was dissolved. However, the union with Norway lasted until 1814.
In 1448, Christian I became king and established on the Danish throne the house of Oldenburg, from which the present ruling family (Schleswig-Holstein-Sonderburg-Glücksburg) is descended. He also united (1460) Schleswig and Holstein with the Danish crown. The Reformation (early 16th cent.) gradually gained adherents in Denmark, and during the reign of Christian III (1534–59) Lutheranism became the established religion. In the late 16th and early 17th cent., Denmark had a brilliant court, with a brisk intellectual and cultural life; the astronomer Tycho Brahe (1546–1601) was a major figure, and the Danish Renaissance style of architecture (strongly influenced by that of the Low Countries) was developed.
The division of power in Denmark between the king and the nobles seriously handicapped the country's attempt to gain supremacy in the Baltic region. Denmark was involved in numerous wars with Sweden and other neighbors; the participation of Christian IV (reigned 1588–1648) in the Thirty Years War (1618–48) and the wars of Frederick III (reigned 1648–70) with Sweden caused Denmark to lose its hegemony in the north to Sweden. The Danish-Swedish Treaty of Copenhagen (1660) confirmed most of the Danish losses imposed by the Treaty of Roskilde (1658).
The wars weakened the nobility by reducing its numbers and strengthened the monarchy by increasing the power and importance of the royal army. Frederick III and Christian V (reigned 1670–99), aided by their minister Count Griffenfeld, were able to make the kingdom an absolute monarchy with the support of the peasants and townspeople. Denmark maintained an imperial status by continuing to rule over Iceland and by establishing (late 17th cent.) the Danish West Indies (see Virgin Islands). In the Northern War (1720–21) against Charles XII of Sweden, Frederick IV (reigned 1699–1730) gained some financial awards and the union of ducal Schleswig with royal Schleswig.
The later 18th cent. was marked by important social reforms carried out by the ministers Johann Hartwig Ernst Bernstorff, Andreas Peter Bernstorff, and Johann Friedrich Struensee. Serfdom was abolished (1788), and peasant proprietorship was encouraged. In the French Revolutionary and Napoleonic Wars, Denmark, having sided with Napoleon I, was twice attacked by England (see Copenhagen, battle of; Copenhagen). By the Treaty of Kiel (1814), Denmark lost Norway to Sweden and Helgoland to England, but retained possession of Greenland, the Faeroe Islands, and Iceland.
In the early 19th cent., Denmark's modern system of public education was started, and there was a flowering of literature and philosophy (led by Hans Christian Andersen and Søren Kierkegaard). As a result of plans for a liberal, centralized constitution, Frederick VII (reigned 1848–63) became involved in a war with Prussia (1848–50) over the status of Schleswig-Holstein. Denmark was defeated and agreed in the London Protocol of 1852 to preserve a special status for the two duchies. In the meantime, a new constitution was promulgated (1849), ending the absolute monarchy and establishing wide suffrage.
The new government attempted (1855) to incorporate Schleswig into the Danish constitutional system, and soon after the accession (1863) of Christian IX war broke out again (1864), this time with Prussia and Austria. Denmark was defeated badly and lost Schleswig-Holstein. This loss of about one third of the Danish territory was, however, offset by great economic gains that transformed Denmark, in the second half of the 19th cent., from a land of poor peasants into the nation with the most prosperous small farmers in Europe. This change was achieved largely by persuading the farmers to specialize in dairy and pork products rather than in grain (which was more expensive to produce than the grain imported from the United States). The folk high schools, originated by N. F. S. Grundtvig (1783–1872), played an important role in reeducating the Danish farmers. At the same time, the cooperative movement flourished in Denmark. Electoral reforms (1914–15) granted suffrage to the lower classes and to women and strengthened the lower chamber of the legislature.
Denmark remained neutral in World War I and recovered North Schleswig after a plebiscite in 1920. In the interwar period and after World War II, Denmark adopted much social welfare legislation and a system of progressive taxation. Although the Social Democratic government of Denmark had signed a 10-year nonaggression pact with Germany in 1939, the country was occupied by German forces in Apr., 1940. Christian X (reigned 1912–47) and his government remained, but in Aug., 1943, the Germans established martial law, arrested the government, and placed the king under house arrest.
Most of the Jewish population (including refugees from other countries) escaped, with Danish help, to Sweden. Among the escapees was Neils Bohr, the Danish physicist who went on to the United States and worked on the atomic bomb project at Los Alamos. The Danish minister in Washington, although disavowed by his government, signed an agreement granting the United States military bases in Greenland. Danish merchant vessels served under the Allies, and a Danish resistance force operated (1945) under the supreme Allied command. Denmark was liberated by British troops in May, 1945. After the war, Denmark recovered quickly, and its economy, especially the manufacturing sector, expanded considerably.
Denmark became (1945) a charter member of the United Nations and, breaking a long tradition of neutrality, joined the North Atlantic Treaty Organization in 1949. Frederick IX became king in 1947. In 1960, Denmark became part of the European Free Trade Association, which it left in 1972 in order to join the European Community (now the European Union). Denmark granted independence to Iceland in 1944 and home rule to the Faeroe Islands in 1948 and to Greenland in 1979. Frederick IX died in 1972 and was succeeded by Margaret II. In 1982, the first Conservative-led government since 1894, a center-right coalition headed by Poul Schlüter, came to power.
Having initially rejected (June, 1992) the European Community's Maastricht Treaty, an agreement that represented a major step toward European unification, Danish voters approved the treaty with exemptions in May, 1993. In 1993, Schlüter resigned; Poul Nyrup Rasmussen, a Social Democrat, became prime minister, heading a center-left coalition that was returned to office in 1998. In a blow to Rasmussen, Danish voters rejected adoption of the euro (see European Monetary System) in a referendum in Sept., 2000. Parliamentary elections in 2001 brought a Liberal party–led conservative coalition to power, and Anders Fogh Rasmussen became prime minister in the minority government. The government remained in office after the 2005 elections.
The publication of cartoons with images of the Prophet Muhammad in a Danish newspaper in Sept., 2005, brought protests from Danish Muslims and ambassadors from Muslim nations, because of Islamic prohibitions on any representation of Muhammad. The protests initially drew tepid responses from the newspaper and Danish officials. The subsequent distribution by Muslim clerics of the cartoons combined with even more offensive images, and the republication of the original cartoons in some other Western and non-Western papers, sparked sometimes violent anti-Danish and anti-Western protests and boycotts of Danish goods in many Muslim nations in early 2006, and led to apologies from the newspaper and Denmark.
After snap parliamentary elections in Nov., 2007, the Liberal-led government remained in office. Rasmussen stepped down in Apr., 2009, to become NATO's secretary-general (beginning in August); Lars Løkke Rasmussen, the finance minister, succeeded him as prime minister. Parliamentary elections in Sept., 2011, resulted in a narrow victory for a three-party center-left alliance led by the Social Democrats, and Social Democratic leader Helle Thorning-Schmidt subsequently became prime minister (and the first woman to hold the post).