Timur had put these Qara Qoyunlu to run away, but in 1406 they regained their capital, Tabriz.
The Timurids relied on their old allies, the Qara Qoyunlus' rival Turkman of the "AqQoyunlu" (White Sheep) clans, whose Jahan Shah was destroyed by the Uzun Hasan of AqQoyunlu by the end of 1467.
In January 1502, Esma'il defeated the army of Alvand Beig of AqQoyunlu, ruler of Azerbaijan, and seized Tabriz and made this city his capital.
The Safavid family intermarried with the AqQoyunlu Turkmen dynasty of Tabriz, which controlled most of western Iran during the last quarter of the 15th century.
In an effort to destroy the power of the Safavid order the AqQoyunlus seized Haydars eldest son Ali Mirza, and two of the latters brothers, Ibrahim and Ismail, and imprisoned them far from their supporters near the city of Shiraz.
In 1493, during a struggle between rival AqQoyunlu princes, Haydars sons were released and allowed to rejoin their Sufi followers.