In 1381, Jogaila attempted to install his loyal brother Skirgaila in Polotsk, Andrei's former domain. As Skirgaila was laying a siege on the rebellious city, Kęstutis and his son Vytautas took the opportunity to start the Lithuanian Civil War against Jogaila and remove him from the throne. Polotsk voluntarily surrendered to Kęstutis, who reinstated Andrei. Sources do not mention him in 1381–1385. Possibly he was waiting in Polotsk for the feud between Jogaila and Kęstutis to be sorted out. Kęstutis died, but Jogaila and Vytautas reconciled in 1384. On October 10, 1385, Andrei signed a treaty with the Livonian Order in which he surrendered to the Order in exchange for protection against Vytautas and other enemies. According to the treaty, Andrei became Order's vassal and received Polotsk as a feudal estate. When Jogaila traveled to Poland to discuss the Union of Krewo, Andrei took the opportunity to renew his war against Lithuania. In 1386, he attacked territories south east of Polotsk. His cause was helped by the Livonian Order, which attacked Duchy of Lithuania, and by Sviatoslav II of Smolensk, who attacked Mstsislaw, taken from the Principality of Smolensk by Algirdas. However, Sviatoslav suffered a great defeat in the Battle of the Vikhra River and the Principality of Smolensk became a vassal of Lithuania.