sentences:  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.During this time Muhammad also tried to gain the offices in the West that had been given to his uncle Muhammad.