These conflicts attracted the attention of Jahan Shah, the ruler of the Qara Qoyunlu, who defeated Ibrahim near Astarabad, forcing him to withdraw to Herat, where he was soon joined by Ala al-Dawla and his forces. However, neither had the strength to resist Jahan Shah and were forced to abandon the city, which was captured in June 1458.[18]