The White Horde (or Blue Horde) remained strong from its foundation (around 1240) until the 1350s. Problems in the west of the horde led to the eventual losses of Wallachia, Dobruja, Moldavia and the western Ukraine and the vassal principalities west of Kiev, losing those lands to Lithuania after being defeated by its army in the Battle of Blue Waters in 1362, and Poland. The death of Jani Beg led to the Blue Horde entering into a prolonged civil war, with concurrent khans fighting each other and holding no real power. At the same time Mamai turned kingmaker in the Blue Horde. In this time, Muscovy seceded from Mongol overlordship (at least until the early 15th century). It was not until the coming of Tokhtamysh that the concurrent khans were removed. He briefly united the Blue Horde with the White Horde in 1380.