Other powers aspiring to the Livonian Baltic access responded by partitioning the Livonian state, which triggered the lengthy Livonian War, fought between 1558 and 1583. Ivan IV of Russia took Dorpat (Tartu) and Narva in 1558, and soon the Danes and Swedes had occupied other parts of the country. To protect the integrity of their country, the Livonians sought a union with the Polish–Lithuanian state. Gotthard Kettler, the new Grand Master, met in Vilnius (Vilna, Wilno) with Sigismund Augustus in 1561 and declared Livonia a vassal state under the Polish King. The agreement of November 28 called for secularization of the Brothers of the Sword Order and incorporation of the newly established Duchy of Livonia into the "Rzeczpospolita" ("Republic") as an autonomous entity. The Union of Vilnius also created the Duchy of Courland and Semigallia as a separate fief, to be ruled by Kettler. Sigismund II obliged himself to recover the parts of Livonia lost to Moscow and the Baltic powers. These conflicts led to grueling wars with Russia (1558–1570 and 1577–1582) and other struggles over control of Baltic trade and freedom of navigation.