John II Casimir of Poland forestalled the Swedish-Prussian alliance by submitting a counter-offer, which Frederick William accepted. On 29 July 1657 they signed the Treaty of Wehlau in Wehlau (). In return for Frederick William's renunciation of the Swedish-Prussian alliance, John Casimir recognized Frederick William's full sovereignty over the Duchy of Prussia (). Thus after more than 130 years of Polish suzerainty, Prussia regained full sovereignty in 1657 (definitively confirmed by the Peace of Oliva in 1660), a necessary prerequisite for elevating Ducal Prussia to become the sovereign Kingdom of Prussia in 1701 (not to be confused with Polish Royal Prussia).