Although it had lost control of all of its Prussian lands, the Teutonic Order retained its territories within the Holy Roman Empire and Livonia, although the Livonian branch retained considerable autonomy. Many of the Imperial possessions were ruined in the German Peasants' War from 1524 to 1525 and subsequently confiscated by Protestant territorial princes. The Livonian territory was then partitioned by neighboring powers during the Livonian War; in 1561 the Livonian Master Gotthard Kettler secularized the southern Livonian possessions of the Order to create the Duchy of Courland, also a vassal of Poland.