When Grand Duke of Lithuania Jogaila married Jadwiga of Poland and was crowned as King of Poland in 1386, he appointed his unpopular brother Skirgaila as viceroy for Lithuania. Vytautas seized the opportunity to renew his struggle for power and started the Lithuanian Civil War. He allied himself with the Teutonic Knights, promising them Samogitia. However, Jogaila and Vytautas reconciled in 1392 by signing the Treaty of Astrava. The Knights, betrayed by Vytautas, invaded Lithuania in 1394 and unsuccessfully besieged Vilnius for three weeks. The invaders were driven away by joint Lithuanian and Polish forces demonstrating that the old raids were no longer effective against the new Polish–Lithuanian alliance. A truce between the Knights and Vytautas was signed in 1396. Vytautas needed to secure his western front as he was planning a massive campaign against the Golden Horde, which resulted in a disaster at the Battle of the Vorskla River in 1399.
Treaty
Former Vytautas' captive and friend Marquard von Salzbach helped to negotiate the agreement. A preliminary treaty was signed on 23 March 1398, in Hrodna; it was finalized in October 1398. According to the treaty Samogitia was ceded to the Knights roughly up to the Nevėžis River, leaving the mouth of Nevėžis in Vytautas' hands. For the first time the Order also received a portion of Sudovia, an almost uninhabited territory north and west of the Šešupė River. The treaty recognized spheres of influence: Veliky Novgorod for Vytautas and Pskov for the Knights. Vytautas also promised to help the Knights build two new castles as compensation for castles he burned in 1392. The Knights promised to help Vytautas in his campaign against the Tatars. The treaty also guaranteed freedom of trade. Sigismund Kęstutaitis and other hostages kept by the Knights since the Civil War were released. During the week-long celebration following successful negotiations, Lithuanian nobles proclaimed Vytautas as King of Lithuania. While such a declaration had no political force, it was a reply to demands by Jadwiga of Poland to pay Polish taxes. It showed their determination to keep the Grand Duchy of Lithuania separate from the Kingdom of Poland despite the Union of Krewo in 1385. Such a proclamation, known only from the chronicles of Johann von Posilge, raised doubts as to reliability among Polish historians. The treaty is noted among Lithuanian historians as it showed the extent of Vytautas' power in Lithuania: he made territorial concessions without approval from Jogaila, who theoretically was the Supreme Duke of Lithuania.
Aftermath
The Order attempted to take control of Samogitia. They took many hostages into Prussia and presented Samogitian nobles with gifts. They also built fortresses – one with Vytautas' help near Nevėžis River and another near Dubysa. The Knights tried to maintain a friendly relationship with Vytautas, warmly welcoming his wife Anna during her pilgrimage to the tomb of Dorothy of Montau and sent him gifts. However, soon disagreements arose when the Order demanded the return of about 4,000 peasants who escaped into Lithuania. Vytautas argued that they were free people and had the right to choose where to live. The disagreement grew into a war. The treaty was violated in March 1401 by Vytautas, who was assured Polish support by signing the Union of Vilnius and Radom in January 1401. The Samogitians organized a local rebellion, capturing and burning the two newly built castles. In the fall of 1401 the Knights raided Kaunas and Hrodna; in May 1402 the Samogitians burned Klaipėda. Vytautas joined the fight in 1402 by attacking Raudondvaris. Jogaila's brother Švitrigaila joined the war on the side of the Teutonic Knights as he had laid claim to the throne of the Grand Duchy of Lithuania. He confirmed the Treaty of Salynas in exchange for Order's military assistance. When neither side could achieve decisive victory and Vytautas wished to concentrate his attention on troubles in Smolensk, the Treaty of Raciąż was signed on 22 May 1404. It mirrored the Treaty of Salynas, but did not solve the disputes. The second Samogitian uprising in 1409 resulted in the Battle of Grunwald in 1410.