the Swedes as far north as Warsaw and Brest. Rákóczi's initially successful offensive had in the end favorable for Poland consequences, as it led to a new configuration of international interests, which prevented the Treaty of Radnot from being implemented. The so-far rather indifferent Austrian Commonwealth's ally became worried about a stronger Transylvania threatening its Hungarian possessions, which led to an auxiliary military agreement negotiated with the Commonwealth representatives in Vienna, and an Austrian diplomatic initiative aimed at separating Brandenburg form Sweden. Lubomirski's forces raided Transylvania and retreating Rákóczi was defeated by the Poles and Tatars at Czarny Ostrów in Podolia. The combined Polish and Austrian forces had retaken Kraków. Denmark joined the war against Sweden and became the Commonwealth's ally. Austrian intermediaries facilitated the decisively important negotiations between Frederick William of Brandenburg-Prussia and the Commonwealth, which in fall of 1657 resulted in the Treaties of Wehlau-Bromberg. The treaties considerably strengthened the Prussian side, as Frederick William, in return for agreeing to abandon Charles Gustav, became a sovereign ruler in Ducal Prussia, ending the historic dependency of East Prussia upon the Commonwealth. The Prussian ruler was also a recipient of other, including territorial (Lębork and Bytów fiefs, Draheim Starostwo), privileges. The Prussian estates ended up with a homage obligation when a new duke is inaugurated, and an eternal alliance required a Prussian ruler to provide modest assistance to the Commonwealth in case of war. Efforts to remove Swedish garrisons from the cities of Royal Prussia and Livonia continued. In 1658 Thorn (Toruń) capitulated after a long siege, but the Swedes kept Marienburg and Elbing (Elbląg) until the end of the war. Charles Gustav moved his main military operation to Denmark. In 1658 a joint Polish-Brandenburg-Austrian expedition into Swedish Pomerania and then Denmark took place. Polish units under Stefan Czarniecki distinguished themselves during the takeover of Alsen Island and the Kolding fortress, and in 1659 in the Battle of Nyborg, where the Swedes suffered a heavy defeat. France worried about Sweden being removed from the Holy Roman Empire pressed for peace negotiations, which commenced in Oliva near Danzig in the early 1660. The Treaty of Oliva was signed in May, after Charles Gustav's death. The Polish side needed now to preserve strength for the struggle with Russia and the old demarcation line was mostly agreed to, with the Commonwealth keeping Courland and southeastern Livonia, including Daugavpils. The Protestants in Royal Prussia