A major diplomatic row, and several wars, emerged from the very complex situation in Schleswig and Holstein, where Danish and German claims collided, and Austria and France became entangled. The Danish and German duchies of Schleswig-Holstein were, by international agreement, ruled by the king of Denmark but were not legally part of Denmark. An international treaty provided that the two territories were not to be separated from each other, though Holstein was part of the German Confederation. In the late 1840s, with both German and Danish nationalism on the rise, Denmark attempted to incorporate Schleswig into its kingdom. The first war was a Danish victory. The Second Schleswig War of 1864 was a Danish defeat at the hands of Prussia and Austria.