[1] Abu'l-Hasan first appears as director of the department of the army (dīwān al-jaysh) under Caliph al-Wathiq (ruled 842–847).
The Caliph esteemed his ability as a poet, and appointed him to oversee seven dīwāns, possibly as a sort of deputy vizier.
[1][2] This disgrace did not last long, and soon he was released and appointed as fiscal administrator (ʿāmil al-kharāj, "supervisor of the land tax") for the Syrian districts of Damascus and Jordan.
Ibn Tulun emerged the victor from this contest: in 871 he overthrew and imprisoned Abu'l-Hasan, confiscated his possessions, and took over the fiscal administration of Egypt himself.
In 877, however, Ibn Tulun took over Syria as well, and upon his entry in Damascus Abu'l-Hasan was imprisoned and forced to pay a ransom of 600,000 dirhams.