Denmark had withdrawn from the Thirty Years' War in the Treaty of Lübeck (1629). After its victories in the war, Sweden felt it had to attack Denmark due to its advantageous geographical position in relation to Sweden. Sweden invaded in a short two-year war. In the Second Treaty of Brömsebro (1645), which concluded the war, Denmark had to make huge territorial concessions and exempt Sweden from the Sound Dues, de facto acknowledging the end of the Danish dominium maris baltici. Danish efforts to reverse this result in the Second Northern, Scanian and Great Northern wars failed.