It was built in 281 Hijri (894 AD) during the reign of Amr ibn al-Layth Saffari, the second ruler of the Saffarid dynasty of Iran.