Schleswig and Holstein were primarily populated by Germans and had been under the rule of the Danish King for centuries.
In 1863, Denmarkformeda new constitution aiming to incorporate Schleswig and Holstein into Denmark.
By that time, nationalist sentiment had already eruptedall over Germany and Bismarck saw a great opportunity for intervention in Schleswig and Holstein.
Liberals in Germany had always been in favour of separating Schleswig-Holstein from Denmark.
Prussia together with Austria sent an ultimatum to Denmark on 16 January 1864 demanding a withdrawal of the constitution which had included Schleswig into Denmark within 48 hours or face military action but Denmark refused.
Denmark was defeated by Prussian and Austrian forces.
In the backdrop of their victory, the Treaty of Gastein wassigned to take control of the annexed territories.
The treaty stated Prussia controlled Schleswig and Austria controlled Holstein.