The war ended on 30 October 1864, with the Treaty of Vienna and Denmark's cession of the Duchies of Schleswig (except for the island of Ærø, which remained Danish), Holstein and Saxe-Lauenburg to Prussia and Austria.