 Justan later agreed to leave the city after having been paid 2,000,000 dirhams.In 869, the Abbasid military officer Muflih al-Turki invaded Tabaristan, and defeated Justan at Qazvin, a city close to Tabaristan.Fortunately for the Alids, however, Muflih shortly left the region.