was opened by two of their men who infiltrated castle security), freed Švitrigaila, and marched to Lutsk. The city was captured and Švitrigaila received support from local nobility, but instead of waging a war, he retreated to Wallachia. For a while, he lived with Ernest, Duke of Austria and Sigismund, King of Hungary. At the same time, an anti-Vytautas rebellion broke out in Samogitia. The Teutonic Knights wanted to use that against Lithuania and invited Švitrigaila to overthrow Vytautas. Instead, Švitrigaila reconciled with Jogaila during a meeting between King Sigismund and Jogaila in Košice in May 1419. Švitrigaila received Opoczno and restored annual income from the Wieliczka Salt Mine. However, that did not reconcile him with Vytautas. After the failed mediation by King Sigismund between Lithuania and the Teutonic Knights, both Poland and Lithuania began preparing for the Gollub War. Polish nobles understood the importance of neutralizing Švitrigaila, who continued to receive Teutonic offers for an alliance, and sent a delegation to persuade Vytautas to forgive his cousin. Eventually, Vytautas relented and the official agreement was concluded in August 1420. Švitrigaila swore loyalty and received Principalities of Briansk, Chernigov, Trubetsk, and Novgorod-Seversk. After the reconciliation, Švitrigaila actively participated in state politics. In the spring of 1421, he won a battle against the Tatars; in the summer of 1422, he participated in the Gollub War and subsequent Treaty of Melno; in 1424–1426, he was sent to a diplomatic mission to Riga; he also took part in Vytautas' raid against Novgorod. Struggle against Sigismund Grand Duke of Lithuania Upon Vytautas's death in October 1430, Lithuanian nobles unilaterally elected Švitrigaila as the Grand Duke. This violated the terms of the Union of Horodło of 1413, where Lithuanians promised not to elect a new Grand Duke without the approval of the Kingdom of Poland. In order to receive Ruthenian votes Švitrigaila granted equal rights to Catholic and Orthodox nobles – it was one lasting achievement of his brief reign. The Polish nobility, led by Zbigniew Oleśnicki, were outraged and demanded that Švitrigaila acknowledged his fealty to his brother Jogaila, King of Poland. Švitrigaila refused and professed full independence. The conflict was further complicated by territorial disputes in Podolia and Volhynia, that according to an agreement in 1411 were to be ruled by Lithuania only for the lifetime of Vytautas. Švitrigaila fought against the Polish–Lithuanian forces at Lutsk in Volhynia, and at the same time