When the amir of Egypt Ahmad ibn Tulun died in 884, Muhammad was presented an opportunity to capture some of his territories in Syria from his inexperienced son and heir, Khumarawayh.
In 889 or 890 Caliph al-Mu'tamid's brother and regent, al-Muwaffaq, appointed Muhammad as governor of Azerbaijan.