The Treaty of Vienna of 1657 replaced the earlier Treaty of Vienna of 1656 (Northern War of 1655-60). The earlier treaty had been agreed between John Casimir of Poland-Lithuania and the Emperor Ferdinand III. Ferdinand had agreed to provide 4,000 troops to help John Casimir in his war against Charles X of Sweden. Unfortunately for Casimir, Ferdinand died in April 1657.
His successor, Leopold, was faced with a potentially tricky Imperial election and possible hostility from either France or Brandenburg (then allied with Sweden, but prone to changing sides during the war). However, one of Charles’s allies was George Rákóczi, prince of Transylvania, whose ambitions threatened Leopold directly.
On 27 May Leopold agreed to a revised treaty. This time Austria was to provide 12,000 men, although they were to be paid by the Poles. In return Austrian troops were to garrison Cracow and Poznan as a guarantee of payment. When the treaty was agreed, Cracow was in Swedish hands, but by the time Austrian troops were able to intervene, Charles X had been called north to deal with a new threat from Denmark. Polish-Lithuanian and Austrian troops occupied Cracow in August 1657.