Battle of Qarabagh was fought on February 4, 1469 between Aq Qoyunlu under Uzun Hasan and Timurids of Samarkand under Abu Sa'id Mirza resulting in the latter's defeat, imprisonment and execution. After the battle the Timurids forever lost any hopes of gaining Iraq or Iran back into their kingdom.
Battle of Qarabagh Wikipedia
Conflict between Kara Koyunlu (Black Sheep Turkomen) under the leadership of Jahan Shah and Aq Qoyunlu (White Sheep Turkomen) under the leadership of Uzun Hasan had taken a decisive turn in the 15th century. During Jahan Shah's reign the Kara Koyunlu’s territory reached its largest extent, including huge swaths of land in Anatolia, most of present-day Iraq, central Iran, and even eventually Kerman. He and his predecessors before him were vassals of the Timurids of Samarkand. However, by mid 15th century, Jahan Shah of Kara Koyunlu recognizing the weakness of Timurid authority in Khurasan, invaded it in Summer of 1458. Timurid ruler of Samarkand, 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 Shahrukh Mirza's times (Jahan Shah keeping Iraq-i-Ajam while Abu Sa'id keeping Khurasan). 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.
Uzun Hasan of Aq Qoyunlu on his part professed his allegiance to the Timurids who were brought to the region by Timur himself. Uzun Hasan had recently gained ascendancy after defeating his rival claimants to the throne in eastern Anatolia at Diyarbakir. He faced threats from the Ottoman Sultanate and the Kara Koyunlu and in wide ranging campaigns against them gained a reputation as a fierce fighter. Jahan Shah of Kara Koyunlu was eventually defeated by Uzun Hasan of Aq Qoyunlu in the Battle of Chapakchur near the sanjak of Çapakçur in present-day eastern Turkey on October 30 (or November 11), 1467. Uzun Hasan kept up the momentum and defeated Jahan Shah's son Hasan Ali at Marand.
Hasan Ali escaped to Khurasan and asked for aid from Abu Sa'id Mirza, the Timurid ruler of Samarkand who was stationed at Merv at that time. Uzun Hasan was worried by this development and wrote a letter reminding the Timurid king of the constant loyalty of his house to the Timurids and the disloyalty of Kara Koyunlu. But Abu Sa'id Mirza had his own reservations about Uzun Hasan's intentions. He also wished to expand his territory to the extent and glory of his great-grand father, Timur Beg Gurkani. He thought of using the premise of restoring Hasan Ali to his throne as a reason to invade the middle east. The expedition which followed is famous in eastern history and is often alluded to by Babur (grandson of Abu Sa'id Mirza) under the name of the Disaster of Iraq-i-Ajam.
Abu Sa'id Mirza advanced into Azerbaijan of Iraq-i-Ajam with a powerful army subduing the country in his course. He sent two detachments; one to take possession of Iraq-i-Ajam, the other of Fars. As he pushed on towards Ardebil and Tabriz among the hills Azerbaijan, Uzun Hassan alarmed at his progress sent repeated embassies to sue for peace but in vain as Abu Sa'id Mirza demanded that the Turkoman should appear in his presence and humble himself before the descendant of Timur Beg Gurkani.
Uzun Hassan refused to submit and being driven to extremity betook himself to the hills and fastnesses in which the country abounds and endlessly employed his troops in harassing and cutting off the supplies of the Timurids whom he prudently avoided meeting in the field. What the sword could not achieve was completed by famine. Uzun Hasan had led Abu Sa'id Mirza on a winter fool's errand. The large army of Abu Sa'id Mirza began to suffer from the pressure of lack of resources for the winter as well as depleting food supplies. For 14 days the royal horses had no barley and as a result the soldiers and officers began to desert in large numbers, alarming Abu Sa'id Mirza. The army having fallen to pieces, Abu Sa'id Mirza was compelled to seek safety in flight. But on 22 Rajab, 873 or (February 4, 1469) was pursued and taken prisoner, possibly by the sons of Uzun Hasan or their men. Of Abu Sa'id Mirza's mighty army few returned to their homes. The greater part were taken prisoners or slaughtered in the course of their long retreat.
Three days afterwards Abu Sa'id Mirza was made over to Yadgar Muhammad Mirza, son of Sultan Muhammad Mirza, son of Baysonqor, son of Shahrukh Mirza who was an ally of Uzun Hasan. Yadgar Muhammad Mirza had Abu Sa'id Mirza either beheaded or poisoned on the pretext that he had his great-grand mother Goharshad killed. Later in 1469, Uzun Hasan had Yadgar Muhammad Mirza proclaimed as Abu Sa'id's successor and provided him with forces so that he could take over Khurasan, which was then controlled by Sultan Husayn Mirza Bayqarah. Defeat of the Timurids was decisive. It dealt a final blow to the Timurid Empire which collapsed into many states. The Timurid realm finally split into two sections, Khurasan and Transoxania, with their adjacent provinces. Power in Khurasan, with Herat as its capital, went to Sultan Husayn Mirza Bayqarah; whereas Transoxania was divided among the four sons of Abu Sa'id Mirza, namely;Sultan Ahmed Mirza, King of Samarkand, Bukhara
Sultan Mahmud Mirza, King of Balkh, Kunduz, Khatlon, Chaghaniyan, Badakhshan and Hissar
Ulugh Beg Mirza II, King of Kabul and Ghazni
Umar Shaikh Mirza II, King of Ferghana and Khujand
The rulers of these provinces were often at war with each other.