Although there is evidence of agricultural settlement as early as 4000 BC and of bronze weaponry and jewelry by 1800 BC , Denmark's early history is little known. Tribesmen calling
themselves Danes arrived from Sweden around AD 500, and Danish sailors later took part in the Viking raids, especially in those against England. Harald Bluetooth (d.985), first Christian king of Denmark, conquered Norway, and his son Sweyn conquered England. During the reign of Canute II (1017–35), Denmark, Norway, and England were united, but in 1042, with the death of Canute's son, Hardecanute, the union with England came to an end, and Norway seceded. During the next three centuries, however, Danish hegemony was reestablished over Sweden and Norway, and in the reign of Margrethe (1387–1412) there was a union of the Danish, Norwegian, and Swedish crowns. In 1523, the Scandinavian union was dissolved, but Norway remained united with Denmark until 1814.
The Reformation was established in Denmark during the reign of Christian III (1534–59). A series of wars with Sweden during the 17th and early 18th centuries resulted in the loss of Danish territory. Meanwhile, under Frederik III (r.1648–70) and Christian V (r.1670–99), absolute monarchy was established and strengthened; it remained in force until 1849. Freedom of the press and improved judicial administration, introduced by Count Johann von Struensee, adviser (1770–72) to Christian VII, were abrogated after his fall from favor. Having allied itself with Napoleon, Denmark was deprived of Norway by the terms of the Peace of Kiel (1814), which united Norway with Sweden; and as a result of the Prusso-Danish wars of 1848–49 and 1864, Denmark lost its southern provinces of Slesvig, Holstein, and Lauenburg. Thereafter, the Danes concentrated on internal affairs, instituting important economic changes (in particular, specialization in dairy production) that transformed the country from a nation of poor peasants into one of prosperous smallholders. Denmark remained neutral in World War I, and after a plebiscite in 1920, North Slesvig was reincorporated into Denmark.
Disregarding the German-Danish nonaggression pact of 1939, Hitler invaded Denmark in April 1940, and the German occupation lasted until 1945. At first, the Danish government continued to function, protecting as long as it could the nation's Jewish minority and other refugees (some 7,200 Jews eventually escaped to neutral Sweden). However, when a resistance movement developed, sabotaging factories, railroads, and other installations, the Danish government resigned in August 1943 rather than carry out the German demand for the death sentence against the saboteurs. Thereafter, Denmark was governed by Germany directly, and conflict with the resistance intensified.
After the war, Denmark became a charter member of the UN and of NATO. In 1952, it joined with the other Scandinavian nations to form the Nordic Council, a parliamentary body. Having joined EFTA in 1960, Denmark left that association for the EEC in 1973. Meanwhile, during the 1950s and 1960s, agricultural and manufacturing production rose considerably, a high level of employment was maintained, and foreign trade terms were liberalized. However, the expense of maintaining Denmark's highly developed social security system, growing trade deficits (due partly to huge increases in the price of imported oil), persistent inflation, and rising unemployment posed political as well as economic problems for Denmark in the 1970s and 1980s, as one fragile coalition government succeeded another.
Economic performance was strong after the mid-1990s. Annual growth of GDP was 3% between 1994 and 1998 although the rate dropped to 1.6% in 1999. (It was projected to be 2.5% in 2004.) Thanks to strong growth, unemployment fell from 12.2% in 1994 to 6% in 1999. In March 2000, the buoyant economic outlook prompted Prime Minister Poul Nyrup Rasmussen to announce a referendum on Economic and Monetary Union to take place on 28 September 2000; it was rejected by 53.2% of the electorate. Voters narrowly rejected the Maastricht Treaty on European Union in 1992, but later approved it in 1993 after modifications were made in Denmark's favor. One of the special agreements was that Denmark could opt not to join EMU. For all practical purposes, however, Danish monetary policy has closely followed that of the European Central Bank and the Danish crown shadows the euro (the European single currency).
As with other European countries, Denmark in the 21st century sees illegal immigration as a major problem. The issue was a deciding one in the 20 November 2001 elections, with the right-wing xenophobic Danish People's Party (founded in 1995) gaining 12% of the vote and 22 seats in parliament. The new government composed of the Liberal Party and the Conservative People's Party formed by Prime Minister Anders Fogh Rasmussen depended upon the Danish People's Party for legislative support. In June 2002, parliament passed a series of laws restricting the rights of immigrants, including the abolition of the right to asylum on humanitarian grounds, and cuts of 30–40% in the social benefits available to refugees during their first seven years of residency.