It is a very hard an complex issue to discuss but I will try anyway!
I tend to think that the Danish government and people were wrong in assuming that the Duchies belonged to them.They had a common sovereign, the king of Denmark also being Duke of Schleswig-Holstein. This happend because King Christian I way back in the 15th century was elected King of Denmark an separetelly elected Duke of Shleswig-Holstein after his uncle. He promised that the Duchies forever would be united for all times, and that Schleswig never became a part of Denmark...so far so good!
As you know, kmerov, I love this issue. Thus, I object to it being so far so good :-)
1. It can't be denied that the Duchy of Slesvig was a Danish fief. Since Charlemagne's time the river Ejder had been recognized as the border between Denmark/Slesvig and the Holy Roman Empire. This was also King Frederik IV's legal pretext for seizing the Gottorp parts of Slesvig after the Great Northern War.
2. The 1460 Treaty of Ribe, binding Slesvig forever to Holstein so
dat se bliwen ewich tosamende ungedelt, that they remain forever united undidived, greatly complicates things. Would it be possible to argue, that although the divisions of the Duchies in royal and ducal parts were engineered to bypass this treaty by giving each part (king and duke) parts in both duchy and letting the manorial districts along the Baltic be jointly ruled, this actual division made the treaty rather hollow and then quite void when King Frederik IV seized the Gottorp territory in Slesvig, leaving Holstein-Gottorp (and its enemy Dukes, among them Tsar Peter III of Russia) a virtually foreign power? So that when the Treaty of Tsarskoe Selo came about, the Treaty of Ribe was already null and void?
Here are a few maps for those interested in the issue:
The Duchies in the 16th and 17th centuries:
Light red - Kingdom of Denmark
Pink - Royal part
Yellow - Ducal part (S-H-Gottorp)
Deep red - non-sovereign cadet lines of the royal line, e.g. the Sønderborgs, Augustenborgs, Glücksborgs etc.
Grey - Manorial Districts ruled in common
Brown - Prince-Bishopric of Lübeck (always held by junior Holstein-Gottorps)
Blue - County of Rantzau
The Duchies in 1721 after the Great Northern War:
Deep blue - Kingdom of Denmark
Light blue - Duchy of Slesvig (all royal) and royal parts of Holstein
Deep Green - Remaining Gottorp parts of Holstein
Hatched green and blue - Jointly ruled manorial districts in Holstein
Light green - S-H-Sønderborg-Plön
Red - The Free Hanseatic Cities of Hamburg and Lübeck.
Purple - Prince-Bishopric of Lübeck
Ochre - the Duchy of Mecklenburg-Schwerin
Brown - Prince-Bishopric of Ratzeburg (belonging to the Duchy of Mecklenburg-Strelitz)
Light orange - Electorate of Hanover (with Duchy of Lauenburg)
The Duchies after the Treaty of Tsarskoe Selo and the Napoleonic Wars:
Holstein-Gottorp has ceased to exist, along with the County of Rantzau and the non-sovereign duchies. Everything is Danish, including the Duchy of Lauenburg. The two plae blue exclaves to the north of the Free Hanseatic City of Lübeck (purple) are the Principality of Lübeck/Eutin, which belongs to the heirs of the Gottorps, the Grand Dukes of Oldenburg. The red line marks not only the border between Slesvig and Holsten, but also the northern boundary of the German Confederation (of which Holstein and Lauenburg are members.)