In 803 he was appointed as governor of Egypt. During his tenure in that province, he received an appeal from the Aghlabid ruler of Ifriqiya Ibrahim ibn al-Aghlab for help to quell disturbances in the region of Tripoli. He remained in Egypt in two years, before being dismissed and replaced with Abdallah ibn Muhammad ibn Ibrahim al-Zaynabi in 805.[8]