Circa 650 CE, during the Arab conquest of the Sasanian Empire, the Sasanian Empire ruler Yazdegerd III was trying to regroup and gather forces around Tokharistan and was hoping to obtain the help of the Turks, after his defeat to the Arabs in the Battle of Nihâvand (642 CE). Yazdegerd was initially supported by the Hephthalite Principality of Chaghaniyan, which sent him troops to aid him against the Arabs. But when Yazdegerd arrived in Merv (in what is today's Turkmenistan) he demanded tax from the "Marzban" of Marw, losing his support and making him ally with the Hephthalite ruler of Badghis, Nezak Tarkan. The Hepthalite ruler of Badghis allied with the "Marzban" of Merv attack Yazdegerd and defeated him in 651. Yazdegerd III barely escaped with his life but was murdered in the vicinity of Merv soon after, and the Arabs managed to capture the city of Merv the same year.