In the waning years of the Empire, Egypt fell to the Sasanian Persian army in the Sasanian conquest of Egypt (618–628). It was then recaptured by the Byzantine emperor Heraclius (629–639), and was finally captured by Muslim Rashidun army in 639–641, ending Byzantine rule.