Sasanian Egypt (known in Middle Persian sources as Agiptus) refers to the brief rule of Egypt and parts of Libya by the Sasanian Empire, following the Sasanian conquest of Egypt. It lasted from 618 to 628, until the Sasanian general Shahrbaraz made an alliance with the Roman Byzantine emperor Heraclius to have control over Egypt returned to him.