Prussia and Denmark had already fought one war in 1848–51 over the territories that lined their common border, Schleswig-Holstein which resulted in Denmark retaining them. By 1864 Austria was at war again, this time allying itself with Prussia against Denmark in the Second Schleswig War, which although successful this time, turned out to be Austria's last military victory. The war concluded with the Treaty of Vienna by which Denmark ceded the territories. The following year the Gastein Convention resolved the control of the new territories, Holstein being allocated to Austria, after initial conflicts between the allies. However this did little to ease the Austria–Prussia rivalry over the German question. The ongoing efforts by Otto von Bismarck, the Prussian Minister President, to revoke the agreement and wrest control of the territories would soon lead to all out conflict between the two powers and achieve the desired weakening of Austria's position in central Europe.