The Jutland peninsula. The Schleswig-Holstein Question led for a two-round military conflict between Denmark and the Confederation of Germany - the First Schleswig War (1848-1851) and the Second Schleswig War (1864). Schleswig (bright red&brown) Holstein (yellow).
Border disputes between neighboring states are pretty common - as well wars between states pretty often have roots due border disputes. In the 19th century a complex set of diplomatic, historical and cultural issues raised tension and pressure about two Duchies - Schleswig and Holstein and their relations to the Danish Crown and the German Confederation.
Since the 12th century (Schleswig became a Danish Duchy) until the 19th Denmark repeatedly tried to integrate Schleswig into the Danish Crown. There was also the question - characterized by the 19th century - of nationality and language. Both - the Danish Crown and the German Confederation justified their claims on to these two Duchies by referring into the past - the fragments of history, cultural practices and dialects. Still, the most decisive question was an international - notably Great Britain opposed the German rise into a sea-power.
Holstein being in this international question also relates to the age-old Treaty of Ribe - in the 15th century Christian I of Denmark became Count of Holstein and he further proclaimed, Denmark should regain the control of lost Duchy of Schleswig and Schleswig-Holstein should never again be partitioned, but always be together.
While the more or less independent dukes ruled for some 400 years in these two duchies, German usually was the language of government, it was spoken in schools and churches, yet Danish was spoken among the majority of peasantry in Schleswig. When arriving to the 19th century the Danish status in Schleswig was vulnerable and continuously weakening - through its strong economic growth also the ethnic German area expanded, the Low-Saxon German immigrants constantly arrived from the south and and the former Danish-speaking families often found it more easy to change their spoken language.
In 1848 Denmark announced to the people of Schleswig the Danish liberal constitution, in which the duchy would still have its autonomous status, but would be integrated into Denmark. Due to this announcement the German majority in Schleswig-Holstein started an open uprising to support an independence from Denmark and search for a close association with the German Confederation. The Prussian Army drove the Danish troops from Schleswig and Holstein, the First Schleswig War had started.

Celebrating the victory - Danish troops return from the war in 1851, Copenhagen.
The First Schleswig War lasted from 1848 to 1851. Who should control Schleswig-Holstein - the war involved foreign troops for instance from Norway, Prussia and Sweden. Under international pressure the war ended signing the London Protocol for a Danish victory over the rebels and the Prussian Army had to withdraw.
The defeat in the war of 1848-1851 meant a failure to form an sovereign and independent state of Schleswig-Holstein, however the unity movement was carried on throughout the 1850's and the early 1860's. As well Denmark tried to integrate Schleswig into the Danish kingdom. The London Protocol had stipulated that the both duchies should be treated the same regarding their relations to the Kingdom of Denmark. The revisions of the Danish constitution of 1848 in the late 1850's and early 1860's led to Holstein's refusal in ratifying. This led to crisis in the parliament in Copenhagen. Eventually it was announced that the constitution and the integration should only apply on Schleswig - not Holstein. This was against the London Protocol and gave Prussia and the German Confederation a casus belli against Denmark.

Prussian victory - the Battle of Als.
The Second Schleswig War of 1864 was again fought of the control of Schleswig-Holstein and Lauenberg. Denmark and the Norwegian-Swedish volunteers fought against the German Confederation, Prussia and the Austrian Empire. The Danish violation of the London Protocol started the war. The war ended in October 1864 with the Treaty of Vienna, Denmark ceded the Duchies of Schleswig, Holstein and Saxe-Lauenberg for Prussia and Austria.
Prussia and Austria took the respective administration of Schleswig and Holstein - about 200 000 of Danes became under the German rule. Following the loss, Christian IX - behind the Danish government backs - offered the whole Denmark could join the German Confederation. However, Bismarck rejected this proposal fearing that the strife between the Danes and Germans could then stay unresolved. The once-existed Duchy of Holstein is today the northernmost state of Germany. In the aftermath of the WWI and during the Versailles Conference Denmark asked to include Schleswig plebiscites about staying a part of Germany or joining Denmark. The request was granted - the southern part of Schleswig voted to remain as a part of Germany, the northern part voted to join Denmark.