Of Khurasani origin, according to al-Kindi he was originally an unimportant member of the so-called "abna’ al-dawla", the Khurasani troops that formed the mainstay of the Abbasid regime. He came to Egypt in 799 in the retinue of al-Layth ibn al-Fadl, and soon rose to a position of influence within the local "abna’". The early years of the 9th century were a time of turmoil for Egypt, where the old-established elites of the original Arab settlers of Fustat losing power to the "abna’" and their rivals, the Yemeni tribes of northern Egypt, grouped around Abd al-Aziz ibn al-Wazir al-Jarawi. Taking advantage of the collapse of Abbasid central authority due to the civil war between al-Amin and al-Ma'mun, Abd al-Aziz and al-Sari, with their respective factions, engaged in a vicious struggle for control of the province that by 813 had effectively divided Egypt between them, with the Yemenis holding the north and al-Sari Fustat and the south.