He was the son of Ali ibn Muhammad al-Maghribi, an official of Persian origin, who became head of the diwan al-maghrib, the "Bureau of the West", whence his family acquired the nisbah of "al-Maghribi". Like his father, Husayn was employed in the Abbasid central bureaucracy in Baghdad, where he married the sister of another official, Abu Ali Harun ibn Abd al-Aziz al-Awariji. Following the fall of the amir al-umara Ibn Ra'iq in 942, Husayn and his brother-in-law left Iraq and sought employment elsewhere. Husayn and his family eventually settled in Egypt, where he entered the service of its ruler, Muhammad ibn Tughj al-Ikhshid. Some time after—according to P. Smoor, probably in 946, when al-Ikhshid died and Abu al-Misk Kafur assumed the de facto governance of the Ikhshidid domains—they left Egypt for the court of the Hamdanid emir Sayf al-Dawla in Aleppo.
Husayn remained in Aleppo as secretary (katib) until the end of his life. By 965, he had risen to become an important personality in the affairs of the Hamdanid emirate, as evidenced by the fact that he briefly served as hostage to the Byzantines during negotiations for a prisoner exchange. He died soon after, or, according to some accounts, before his return to Hamdanid territory. His son, Abu'l-Hasan Ali, succeeded him in Hamdanid service, before switching to the Fatimid court, where he until his execution along with almost the entire family in 1010. Only his namesake grandson, Abu'l-Qasim al-Husayn, escaped the massacre and served successively in the Buyid, Marwanid and Uqaylid courts until his death in 1027.