Negotiations with France and Sweden were conducted in conjunction with the Imperial Diet, and were multi-sided discussions involving many of the German states. This resulted in the treaties of Münster and Osnabrück, making peace with France and Sweden respectively. Ferdinand resisted signing until the last possible moment, doing so on 24 October only after a crushing French victory over Spain at Lens, and with Swedish troops on the verge of taking Prague.