In the meantime, Tokhtamysh, now khan of the Golden Horde, turned against his patron and in 1385 invaded Azerbaijan. The inevitable response by Timur resulted in the Tokhtamysh–Timur war. In the initial stage of the war, Timur won a victory at the Battle of the Kondurcha River. After the battle Tokhtamysh and some of his army were allowed to escape. After Tokhtamysh's initial defeat, Timur invaded Muscovy to the north of Tokhtamysh's holdings. Timur's army burned Ryazan and advanced on Moscow. He was pulled away before reaching the Oka River by Tokhtamysh's renewed campaign in the south.