That same year, Casimir was approached by the Prussian Confederation for aid against the Teutonic Order, which he promised, by making the separatist Prussian regions a protectorate of the Polish Kingdom. However, when the insurgent cities rebelled against the Order, it resisted and the Thirteen Years' War (1454–1466) ensued. After a long and expensive war, Casimir and the Prussian Confederation defeated the Teutonic Order. In the Second Peace of Thorn (1466), the Order recognized Polish sovereignty over the seceded western Prussian regions, Royal Prussia, and the Polish crown's overlordship over the remaining Teutonic Monastic State, transformed in 1525 into a duchy, Ducal Prussia.