Ahmad was the son of al-Khasib ibn 'Abd al-Hamid, a finance officer in
Egypt during the reign of
Harun al-Rashid (r. 786–809). Abd al-Hamid may have been same as
Abu al-Khasib, the first
Hajib of
al-Mansur, although this is uncertain. Early in Ahmad's career, he entered the service of the
Turkic general
Ashinas, becoming the latter's secretary (
katib). In 838 he is mentioned as assisting Ashinas in thwarting a plot by several military officers to assassinate the caliph
al-Mu'tasim (r. 833–842) during the
Amorion campaign. During the reign of
al-Wathiq (r. 842–847), he was one of the targets of a general crackdown against the government secretaries in 843-4, during which he and his subordinates were fined and forced to hand over one million
gold dinars to the caliph. Under
al-Mutawakkil (r. 847–861) he was assigned as secretary to
al-Muntasir, the caliph's eldest son and heir. Following the assassination of al-Mutawakkil by his Turkish bodyguards in December 861, Ahmad quickly worked to secure the succession for al-Muntasir. The army, secretaries and eminent men were assembled and Ahmad read to them an official version of the caliph's murder, claiming (falsely) that he had been killed by his favorite companion
al-Fath ibn Khaqan. He also had an
oath of allegiance drawn up and administered to everyone present. Al-Muntasir's younger brothers
al-Mu'tazz and
al-Mu'ayyad immediately recognized the new caliph, and al-Muntasir was able to establish his position without incident. Ahmad, now serving as al-Muntasir's vizier, held a dominant position in the new caliph's administration. According to
al-Tabari, he was able to get rid of a rival, the general
Wasif al-Turki, by convincing the caliph to
send him on a campaign at the
Byzantine frontier. He also plotted with the Turkish officers to deprive al-Mu'tazz and al-Mu'ayyad of their rights to succeed al-Muntasir in the event of the latter's death, as they feared that al-Mu'tazz would eradicate them if he became caliph. Al-Muntasir eventually agreed to this and the two brothers were forced to abdicate their position as heirs apparent. After the death of al-Muntasir in June 862, the officers
Utamish,
Bugha al-Kabir and
Bugha al-Sharabi met to select a new caliph. Ahmad arranged for the
mawlas in the army to accept whoever they decided upon, and gave his approval when the group chose
al-Musta'in, a grandson of al-Mu'tasim. He became the new caliph's secretary, while Utamish became vizier. Following a riot in favor of al-Mu'tazz at al-Musta'in's inauguration, Ahmad prevented the Turks from killing al-Mu'tazz and al-Mu'ayyad in retaliation, although he did order the brothers to be jailed instead. Shortly after this, however, the
mawlas became hostile against Ahmad, and this resulted in his downfall. In July/August 862 he and his sons had their possessions confiscated and Ahmad was banished to
Crete. He died there in 879. His grandson, Ahmad ibn Ubayd Allah ibn Ahmad, more commonly known as al-Khasībī, remained vizier of caliphs
al-Muqtadir and
al-Qahir. == Notes ==