Upon Muhammad's death in November 867, Ubaydallah assumed the governorship of Baghdad as his brother's designated successor, and he quickly received formal confirmation from al-Mu'tazz.
Following Sulayman's death in late 879, Ubaydallah was again appointed as head of security (shurtah) in Baghdad, this time as deputy to the Saffarid Amr ibn al-Layth, who had been granted that position by the central government.