Defection to Hungary Accounts on Švitrigaila's activities in 1394–1397 are conflicting. Older historians followed
Jan Długosz and claimed that he escaped to the
Teutonic Knights in Prussia right after the capture of Vitebsk, but Polish historian
Aleksander Narcyz Przezdziecki disproved it. Probably around 1396 or 1397, Švitrigaila and , a son of
Liubartas who was ousted from
Volhynia near the conclusion of the
Galicia–Volhynia Wars, escaped from Kraków to
Duchy of Cieszyn, fief of the
Kingdom of Bohemia, and from there to the court of
Sigismund of Luxemburg. Švitrigaila contacted the
Teutonic Knights, a long-standing enemy of Lithuania, and proposed an alliance against Vytautas. It was not an unprecedented move: Vytautas had done the same in 1382 and 1390 when he fought with Jogaila. However, the Knights concluded the
Treaty of Salynas with Vytautas in October 1398 and Švitrigaila lost any hopes of an armed rebellion. He reconciled with Vytautas and received
Navahrudak and a portion of
Podolia not ruled by
Spytek of Melsztyn. In 1399, Švitrigaila survived the disastrous
Battle of the Vorskla River against the
Golden Horde. Spytek of Melsztyn was killed in the battle and Švitrigaila received his lands in Podolia.
Defection to Prussia In January 1401, Vytautas and
Lithuanian nobles concluded the
Pact of Vilnius which made him the grand duke and confirmed that after Vytautas' death, Lithuania would be ruled by Jogaila and his heirs. That crushed Švitrigaila's ambition to one day become the grand duke of Lithuania. The chronicler
Jan Długosz hinted that the pact was in part motivated by the desire to contain the growing influence and ambitions of Švitrigaila. According to
Johann von Posilge, Švitrigaila was forced to sign the pact. However, just a month later, he wrote to
Siemowit IV of Masovia trying to form an alliance against Vytautas. Vytautas instigated the
First Samogitian Uprising against the Teutonic Knights that started in March 1401. In August,
Yury of Smolensk and his father-in-law,
Oleg II of Ryazan, started a rebellion to retake the
Principality of Smolensk. Švitrigaila decided to take advantage of these conflicts. In January 1402, instead of traveling to the wedding of Jogaila and
Anna of Cilli, Švitrigaila, disguised as a merchant, traveled to
Marienburg, the capital of the Teutonic Knights. On 2 March 1402, he concluded a treaty with the Knights which in essence confirmed the
Treaty of Salynas. In July 1402, the Knights, including Švitrigaila, invaded Lithuania and marched towards
Vilnius, the capital of Lithuania, however Vytautas learned of the planned treason and executed six city residents. The Knights did not dare to lay the siege and returned to Prussia. Vytautas wanted to concentrate on the rebellion in Smolensk and peace negotiations started in summer 1403. The truce was signed in December 1403 and the
Peace of Raciąż in May 1404. The Knights received territorial concessions in
Samogitia while Švitrigaila received
Podolia (though the territory was
de facto governed by ),
Zhydachiv, and an annual sum of 1,400 marks from the
Wieliczka Salt Mine from Jogaila and the
Principalities of Briansk,
Chernigov, and
Trubetsk from Vytautas.
Defection to Moscow and imprisonment For a few years, Švitrigaila was loyal to Vytautas and helped to subdue Smolensk and negotiate with the Teutonic Knights regarding the
Dobrzyń Land. Švitrigaila's new territories bordered the
Grand Principality of Moscow, which began to emerge as the main rival to Lithuania. He decided to rebel against Vytautas once again but this time with the help of
Vasily I of Moscow, who was also Vytautas' son-in-law. In May 1409, Švitrigaila, along with a great number of dukes and boyars, defected to Moscow. Vasily I rewarded Švitrigaila with
Vladimir,
Volokolamsk,
Pereslavl,
Rzhev, and half of
Kolomna. Vytautas immediately gathered an army, including 5,000 Polish men commanded by
Zbigniew of Brzezia and one flag of Teutonic Knights, and marched towards Russia. The two armies met on the
Ugra River, but did not engage in battle. The Lithuanian army was exhausted and lacked food while the Russians needed to defend themselves from an invasion of the
Golden Horde, commanded by
Edigu. A peace treaty was concluded, which treated the Ugra River as the border between Russia and Lithuania. It is not known what happened to Švitrigaila after the standoff at the Ugra River. According to a contemporary Teutonic report, Vytautas demanded that as a condition for peace Vasily I would surrender Švitrigaila, but Vasily I claimed that he had escaped to the Golden Horde. The report further elaborated that Švitrigaila received a marriage proposal to a daughter of a Tatar
emir. However, in June 1409, Švitrigaila returned to the court of Vytautas. Restless, he again attempted to conspire with the Teutonic Knights, but the letters were intercepted. Švitrigaila was arrested and imprisoned in various locations until he was settled in the
Kremenets Castle, the only brick castle in
Volhynia. There he had at least some freedom as he signed land donations.
Escape to Hungary and reconciliation Švitrigaila remained imprisoned for nine years until his escape was organized by Dashko Feodorovich Ostrogski, Aleksander Nos, and Alexander of Smolensk. During the night of 24 March 1418, the conspirators, with 500 men, invaded the Kremenets Castle (the gate 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 the principalities of
Bryansk,
Chernigov,
Trubetsk, and
Novgorod-Seversk. After their 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==