At the start of his reign, Jogaila was preoccupied with unrest in the Lithuanian Rus' lands. In 1377–78, Andrei of Polotsk, the eldest son of Algirdas, challenged Jogaila's authority and sought to become Grand Duke. In 1380, Andrei and another brother, Dmitry, sided with Prince Dmitri of Moscow against Jogaila's alliance with emir Mamai, de facto khan of the Golden Horde. Jogaila failed to support Mamai, lingering in the vicinity of the battlefield, which led to Mamai's army's significant defeat at the hands of Prince Dmitri in the Battle of Kulikovo. The Muscovites' Pyrrhic victory over the Golden Horde, in the long term, signified, however, the beginning of a slow climb to power by the Grand Duchy of Moscow, which became within a century the most serious rival and threat to the integrity, well-being and survival of Lithuania. However, in 1380 Muscovy was greatly weakened by tremendous losses suffered during the battle and thus, in the same year, Jogaila was free to begin a struggle for supremacy with Kęstutis.