Muhammad ibn Tahir

In 867, the Saffarid amir of Sistan, Ya'qub al-Saffar, took Herat and imprisoned its Tahirid governor.

An army was dispatched under the Samanid Ibrahim ibn Ilyas to stop Ya'qub, but was defeated, after which Muhammad was forced to come to terms.

For three years he remained in captivity, but was freed by caliphal forces after the Saffarids were defeated at the Battle of Dair al-'Aqul in 876.

[3] After being freed by the caliph, Muhammad took up residence in Baghdad and from there attempted to gain the offices held by Ubaydallah ibn Abdallah.

As the governor of Khurasan, Amr now asserted the rights formally held by the Tahirids to nominate his representative for the offices in the West; his choice fell on 'Ubadydallah.