Khurasan was conquered by the Muslims during the caliphate of Umar. For undertaking campaigns against Khurasan, Umar appointed Ahnaf b Qais to the chief command. Ahnaf b Qais led the Muslim army from Isfahan. From Isfahan two routes led to Khurasan. The main route was via Rayy and Nishapur. The other route which was less frequented led to Herat by passing Nishapur, and then to Merv. Ahnaf b Qais followed the less frequented route. On the march to Khurasan the first encounter took place at Tabas. The Persian garrison offered feeble resistance which was overcome and the city was captured by the Muslims. The next encounter took place at Tun. Here too the Persian garrison surrendered after offering some show of resistance. Thereafter the Muslim army invested Herat. Here the Persian garrison offered stiff resistance. The siege lasted for a month, and fighting further resistance useless the Persians surrendered. From Herat the Muslim army marched to Nishapur. The people of Nishapur did not choose to fight and surrendered on the condition of paying a tribute. From Nishapur the Muslim army advanced to Tus which was captured after some show of resistance. Thereafter the Muslim army advanced to Merv. Yazdjurd the Persian emperor fled from Merv to Balkh. The Persian resistance at Merv was overcome, and the Muslims became the masters of Merv.
Yazdjurd obtained reinforcements from Farghana, and made a stand at Balkh. The Muslim army advanced to Balkh, but before beginning the battle they took steps to separate the Turks and the Persians. The Turkish army took the field after there heralds had sounded the bugle. Ahnaf b Qais adopted the strategy to prevent the heralds from sounding the bugles. Ahnaf b Qais along with a reserve hid themselves at a convenient place, and when the first herald came to sound the bugle, they caught hold of him and killed him, before he could sound tile bugle. The second and third heralds met the same fate. The war bugles thus did not sound that day. When the Turkish commander inquired into the cause as to why the bugles had not been sounded he found that all the heralds had been killed. He considered this to be a bad omen. He asked the Turkish forces to break the camp and return to their country. The Muslim forces thereafter attacked the Persians who were defeated and Balkh was captured. Yazdjurd crossed the Oxus and sought refuge with the Turks. Ahnaf b Qais returned from Balkh to Merv. Umar ordered that the Muslims should consolidate their conquests in Khurasan, but should not cross the Oxus and undertake any campaigns in Transoxiana.