Nevertheless, subsequent attempts on the part of Poland to subordinate Lithuania drove Witowt for the third time into the arms of the Order, and by the treaty of Salin in 1398, Witowt, who now styled himself Supremus Dux Lithuaniae, even went so far as to cede his ancestral province of Samogitia to the knights, and to form an alliance with them for the conquest and partition of Pskov and Great Novgorod.
The result was a whole series of wars with the Teutonic Order, which now acknowledged Swidrygiello, another brother of Jagiello, as grand-duke of Lithuania; and though Swidrygiello was defeated and driven out by Witowt, the Order retained possession of Samogitia, and their barbarous methods of "converting" the wretched inhabitants finally induced Witowt to rescue his fellow-countrymen at any cost from the tender mercies of the knights.
Olgierd was succeeded by his son Jagiello as grand duke in 1377, while Kiejstut was left in possession of Samogitia, Troki and Grodno; but the Teutonic Order, alarmed at the growth of Lithuania, succeeded in estranging uncle and nephew, and Kiejstut was treacherously assassinated by Jagiello's orders, at Krewo, on the 15th of August 1382.
Three weeks later Jagiello was compelled to cede Samogitia, as far as the Dubissa, to the Knights, and, in the following year they set up against him Kiejstut's son Witowt.
Skilfully taking advantage of the jealousies of Poland and Lithuania, as they were accentuated by the personal antagonism of Jagiello and Witowt (q.v.), with the latter of whom the Knights more than once contracted profitable alliances, they even contrived (Treaty of Salin, 1378) to extend their territory by getting possession of the province of Samogitia, the original seat of the Lithuanians, where paganism still persisted, and where their inhuman cruelties finally excited the horror and indignation of Christian Europe.
The wisdom of this arrangement was made manifest in 1410, when Jagiello and Witowt combined their forces for the purpose of delivering Samogitia from the intolerable tyranny of the Knights.
But the excessive caution of Jagiello gave the Knights time to recover from the blow; the Polish levies proved unruly and incompetent; Witowt was suddenly recalled to Lithuania by a Tatar invasion, and thus it came about that, when peace was concluded at Thorn, on the 1st of February 1411, Samogitia (which was to revert to the Order on the death of Jagiello and Witowt), Dobrzyn, and a war indemnity of 10o,000 marks payable in four instalments, were the best terms Poland could obtain from the Knights, whose territory practically remained intact.
In 1599 he was appointed starosta of Samogitia, and in 1600 acting commander-in-chief of Lithuania.
Gedymin inherited a vast domain, comprising Lithuania proper, Samogitia, Red Russia, Polotsk and Minsk; but these possessions were environed by powerful and greedy foes, the most dangerous of them being the Teutonic Knights and the Livonian knights of the Sword.
But he was still a pagan reigning over semi-pagan lands; he was equally bound to his pagan kinsmen in Samogitia, to his orthodox subjects in Red Russia, and to his Catholic allies in Masovia.