Various petty kingdoms existed throughout the area now known as Denmark for many years. Between c. 960 and the early 980s,
Harald Bluetooth appears to have established a kingdom in the lands of the Danes which stretched from Jutland to Skåne. Around the same time, he received a visit from a German
missionary who, according to legend[
citation needed], survived an
ordeal by fire, which convinced Harold to convert to
Christianity. The new
religion, which replaced the old
Norse religious practices, had many advantages for the king. Christianity brought with it some support from the
Holy Roman Empire. It also allowed the king to dismiss many of his opponents who adhered to the old mythology. At this early stage there is no evidence that the Danish Church was able to create a stable administration that Harald could use to exercise more effective control over his kingdom, but it may have contributed to the development of a centralising political and religious ideology among the social elite which sustained and enhanced an increasingly powerful kingship.
After the death of
Canute the Great in 1035,
England broke away from Danish control and Denmark fell into disarray for some time. Vikings from
Norway raided Denmark sporadically. Canute's nephew
Sweyn Estridson (1020–74) re-established strong royal Danish authority and built a good relationship with the
archbishop of
Bremen — at that time the Archbishop of all of
Scandinavia.
In the early 12th century Denmark became the seat of an independent
church province of Scandinavia. Not long after that,
Sweden and
Norway established their own archbishoprics, free of Danish control. The mid-12th century proved a difficult time for the kingdom of Denmark. Violent
civil wars rocked the land. Eventually,
Valdemar the Great (1131–82), gained control of the kingdom, stabilizing it and reorganizing the administration. King Valdemar and
Absalon (
ca 1128–1201), the
bishop of Roskilde, rebuilt the country. During Valdemar's reign construction began of a castle in the village of Havn, leading eventually to the foundation of
Copenhagen, the modern capital of Denmark. Valdemar and Absalon built Denmark into a major power in the
Baltic Sea, a power which later competed with the
Hanseatic League, the counts of
Holstein, and the
Teutonic Knights for trade, territory, and influence throughout the Baltic.
In 1168, Valdemar and Absalon gained a foothold on the southern shore of the Baltic, when they subdued the Principality of Rügen.
In the 1180s, Mecklenburg and the Duchy of Pomerania came under Danish control, too. In the new southern provinces, the Danes promoted Christianity (mission of the Rani, monasteries like Eldena Abbey) and settlement (Danish participation in the Ostsiedlung). The Danes lost most of their southern gains after the Battle of Bornhöved (1227), but the Rugian principality stayed with Denmark until 1325.
In 1202,
Valdemar II became king and launched various "
crusades" to claim territories, notably modern
Estonia. Legend has it that the Danish flag, the
Dannebrog fell from the sky during the
Battle of Lyndanisse in Estonia in 1219. A series of Danish defeats culminating in the Battle of Børnehoved on 22 July 1227 cemented the loss of Denmark's north German territories. Valdemar himself was saved only by the courageous actions of a German knight who carried Valdemar to safety on his horse.
From that time on Valdemar focused his efforts on domestic affairs. One of the changes he instituted was the feudal system where he gave properties to men with the understanding that they owed him service. This increased the power of the noble families (
Danish:
højadelen) and gave rise to the lesser nobles (
Danish:
lavadelen) who controlled most of Denmark. Free peasants lost the traditional rights and privileges they had enjoyed since Viking times.[3]
The king of Denmark had difficulty maintaining control of the kingdom in the face of opposition from the
nobility and from the Church. An extended period of strained relations between the crown and the
Popes of
Rome took place, known as the "archiepiscopal conflicts".
By the late 13th century, royal power had waned, and the nobility forced the king to grant a
charter, considered Denmark's first
constitution. Following the
Battle of Bornhöved in 1227, a weakened Denmark provided windows of opportunity to both the Hanseatic League and the
Counts of Holstein. The Holstein Counts gained control of large portions of Denmark because the king would grant them fiefs in exchange for money to finance royal operations.
Valdemar spent the remainder of his life putting together a code of laws for
Jutland,
Zealand and
Skåne. These codes were used as Denmark's legal code until 1683. This was a significant change from the local law making at the regional assemblies (
Danish:
landting) had been the long-standing tradition. Several methods of determining guilt or innocence were outlawed including trial by ordeal and trial by combat. The
Code of Jutland (
Danish:
Jyske Lov) was approved at meeting of the nobility at Vordingborg in 1241 just prior to Valdemar's death. Because of his position as "the king of Dannebrog" and as a legislator, Valdemar enjoys a central position in Danish history. To posterity the civil wars and dissolution that followed his death made him appear to be the last king of a golden age.
The
Middle Ages saw a period of close cooperation between the
Crown and the
Roman Catholic Church. Thousands of church buildings sprang up throughout the country during this time. The economy expanded during the 12th century, based mostly on the lucrative
herring-trade, but the 13th century turned into a period of difficulty and saw the temporary collapse of royal authority.