Under al-Mu'tasim, he served as sahib al-shurta at Samarra, and became commander of the Caliph's personal guard.[1] By the time of the accession of al-Wathiq in 842, he was, along with the Turk Ashinas, the "mainstay of the caliphate".[3] Al-Wathiq named him governor of the Yemen in 843/4.[1] After the death of Ashinas, in 844/5, he was named governor of Egypt, but he appointed Harthamah ibn al-Nadr al-Jabali there in his stead.[1][3] Ya'qubi further reports that under al-Wathiq, he was appointed to the governorships of Khurasan, al-Sind, and the sub-provinces of the Tigris River.[1]