the treaty was primarily directed against Andrei and his allies – brother Dmitry of Bryansk and Grand Duke of Moscow Dmitri Donskoi. Jogaila, having secured his western front, allied himself with the Golden Horde against the Grand Duchy of Moscow for the upcoming Battle of Kulikovo. Without violating the Treaty of Dovydiškės, the Teutonic Knights raided the Duchy of Trakai and Samogitia twice. In August 1381, Komtur of Osterode informed Kęstutis about the secret treaty. In the same month Kęstutis took advantage of Polotsk's rebellion against Skirgaila. Jogaila was away to subdue the rebellion and his absence provided a good opportunity to capture Vilnius, capital of the Grand Duchy. Kęstutis became the Grand Duke while Jogaila was taken prisoner on his way back to Vilnius. Jogaila pledged his loyalty to Kęstutis and was released. He received his patrimony, Kreva and Vitebsk. Kęstutis resumed war with the Teutonic Knights: his army raided Warmia and attempted to capture Georgenburg (Jurbarkas). On 12 June 1382, while Kęstutis was away to fight Dymitr Korybut of Novhorod-Siversky and Vytautas was away in Trakai, residents of Vilnius, led by merchant Hanul of Riga, let Jogaila's army into the city. The merchants were dissatisfied with Kęstutis's policies as they were hurting the economy, especially trade with Livonia. Jogaila recaptured the throne and allied with the Teutonic Knights. In the meantime Kęstutis rallied his supporters in Samogitia, his son Vytautas sought soldiers in Hrodna, and his brother Liubartas recruited in Galicia–Volhynia. In August 1382 armies of Kęstutis and Jogaila met near Trakai for a decisive battle, but it never began. Both sides agreed to negotiate. Kęstutis and Vytautas arrived to Jogaila's camp, but were arrested and sent to a prison in the Kreva Castle. Their army was disbanded. On 15 August, five days after imprisonment, Kęstutis was found dead by Skirgaila. Jogaila claimed that he hanged himself, but few believed him. Jogaila organized a large pagan funeral to Kęstutis: his body was burned with horses, weapons, and other treasures in Vilnius, presumably in Šventaragis' Valley. Vytautas managed to escape and continued to fight Jogaila to become Grand Duke in 1392. Legacy Kęstutis is a popular male name in Lithuania. Mikalojus Konstantinas Čiurlionis wrote a symphonic overture Kęstutis in 1902. Petras Tarasenka, Lithuanian historian and archeologist wrote a short story Pabėgimas (The Escape) in 1957, depicting Kęstutis's escape from the Teutonic Order captivity in Marienburg Castle. The monument to