Recognizing the weakness of Timurid authority in Herat, Jahan Shah of Kara Koyunlu invaded & took the city on June 28, 1458, which was then occupied by Ibrahim Mirza's father Ala al-Dawla Mirza.[2] But Abu Sa'id Mirza could not tolerate this occupation. After Jahan Shah had taken Herat, he was in a tough position and unable to keep it due to pressures from within his kingdom of Kara Koyunlu plus the increasing threat from Uzun Hasan of Aq Qoyunlu. He was obliged to negotiate the borders of his state with Abu Sa'id Mirza and after negotiations Jahan Shah decided to return territorial demarcation to Shah Rukh's times.[2] Thus, Khurasan, Mazandaran and Jurjan were returned to the Timurids and Abu Sa'id Mirza returned and took Herat a second time on December 22, 1458.[2]
While leaving the territory, however, the Turkmens ravaged Khurasan and when Abu Sa'id Mirza arrived to take Herat the people were frightened.[1] So in order to ease their fears, he sent back the major portion of his army towards Bukhara.[1] His rival claimants to the Kingdom of Samarkand, namely, Ala al-Dawla Mirza, his son Ibrahim Mirza and Sultan Sanjar Mirza seeing his position weakened decided to form an alliance and take this opportunity to destroy him once and for all.[1] They planned to meet at Sarakhs and from there move forward to attack Herat.[citation needed]
When Abu Sa'id Mirza received intelligence of this advance, he set out to meet this threat head on despite being numerically outnumbered and sent for reinforcements.[1]
Battle
The battle of Sarakhs was fought when the vanguard of Ala al-Dawla Mirza, Ibrahim Mirza and Sultan Sanjar Mirza appeared between Marv and Sarakhs.[1] Battle lines were drawn and a pitched battle ensued. Reinforcements arrived for Abu Sa'id Mirza at the right time under Amir Ali Farsi and Amir Syed Asil with the help of whom he defeated his enemies.[1] Amir Ali Farsi and Amir Syed Asil were sent in pursuit of Ala al-Dawla Mirza and Ibrahim Mirza, who had fled to Mazniyan whereas Sultan Sanjar Mirza was captured and was executed.[1]
Ibrahim Mirza died in 1460 and Ala al-Dawla Mirza died in 1461, ending all opposition to a sole Timurid ruler in Transoxiana.[1]