to their own territory. Bahram himself pursued the Hepthalites to the river Oxus in Margiana and sent one of his generals beyond the river who crippled them greatly. Despite this, the Hepthalites returned in around 480 AD and occupied Margiana until 565 AD. In 642 AD, after the Sasanian disaster at the hands of the Rashidun Caliphate at the Battle of Nihawand, much like Darius III, the last Sasanian king, Yazdegerd III, fled eastward and arrived in Margiana in 651 AD. Yazdegerd was well received by Mahoe Suri, the marzban of Merv, however, upon arrival Yazdegerd appointed his courtier Farrukhzad as marzban and ordered that Mahoe give absolute control of the city over to him. Mahoe refused and Farrukhzad advised the king to retreat to Tabaristan, which he ignored. Farrukhzad then left for Tabaristan, where he would later become king himself. As the Muslim army approached, Mahoe plotted with the Hepthalite ruler Nezak Tarkan to overthrow Yazdegerd who later discovered the plot and retreated to Marwir-Rawdh in southern Margiana. Mahoe agreed to pay tribute to the Rashidun general Ahnaf ibn Qais who began to consolidate Islam in Margiana and awaited reinforcements. Ahnaf captured Merw i-Rud, forcing Yazdegerd to flee to Balkh with his remaining supporters. Ahnaf was ordered by the Caliph Umar ibn al-Khattab to remain at Merv and not pursue Yazdegerd. However, upon learning that Yazdegerd had formed an alliance with Hepthalites beyond Margiana and was approaching Merv, Ahnaf rallied his forces and defeated Yazdegerd at the Battle of Oxus River. After his defeat, the Sasanian king attempted to hide in a mill where he was killed by a Margian miller, bringing the Sasanian Empire to an end. Religion Margiana's position along the Silk Road led to the development of a diverse religious demography in the period prior to the Islamic Conquest. Although most of the population in Margiana practised Zoroastrianism, Buddhist, Christian, Manichaean and Jewish communities also existed and thrived in Margiana. Buddhist monasteries are known to have existed in Margiana, and the city of Merv acted as a major centre of Buddhist learning. A Manichaean community is known to have existed from the mid 3rd century AD. According to Al-Biruni, Christianity had spread to Margiana within 200 years of the birth of Christ. In the 3rd century AD, at least one Christian monastery was founded and a reference to a diocese based in Merv is first mentioned