After the Battle of Qadisiyya in 636, the last Sasanian ruler, Yazdegerd III (r. 632–651), took refuge in Hulwan for a while during his flight from Ctesiphon. After another heavy defeat at the Battle of Jalula in 637, Yazdegerd left Hulwan for the eastern provinces of his realm, and the town fell into the hands of the pursuing Arabs under Jarir ibn Abdallah Bajali in 640. In the early 640s, the town was of strategic importance as a frontier post between the Mesopotamian lowlands and the still Sasanian-controlled Iranian plateau, and was garrisoned by troops, including Persian defectors (the "Khamra"), who were settled there under the Rashidun caliphs.