In 1382, Circassian slaves took the Mamluk throne, the Burji dynasty took over and the Mamluks became a Circassian state. The Mongols, who started invading the Caucasus in 1223, destroyed some of the Circassians and most of the Alans. The Circassians, who lost most of their lands during the ensuing Golden Horde attacks, had to retreat to the back of the Kuban River. In 1395 Circassians fought violent wars against Tamerlane, and although the Circassians won the wars, Tamerlane plundered Circassia.