The only resistance offered to Timur was that of the Turkoman Qara-Quiunlu, under their chieftain Qara Yusuf. The Qara Quiunlu were predominantly Shi'ite and it may have been religious rivalry which prompted their distant kinsmen, the Aq-Quiunlu, who were predominantly Sunni, to side with Timur. The two tribes derived their names from the colour of the sheep they had on their banners, the Qara-Quiunlu having a black sheep and the Aq-Quiunlu having a white one. Qara Yusuf's resistance was not effective and he was forced eventually to seek refuge in Egypt. After Timur's death, Qara Yusuf returned to the fray taking Tabriz in 1407 continuing as a thorn in the side of the Timur's
successor Shah Rukh, who won a series of indecisive victories against him. Qara Yusuf's son, Iskandar, continued the guerilla war against Shah Rukh after his father's death in 1420, and was in
turn succeeded by his brother Jahanshah in 1438. He captured Isfahan in 1453, built the famous Blue Mosque in Tabriz in 1465, but was defeated by the Aq-Quiunlu chieftain Ouzun Hassan in
The Masjed-e-Jomeh in Isfahan received a major impetus during the reign of the latter under whose guidance much of the work on the Southern portico (shown above) was undertaken. He undertook further major repairs to this part of the building between 1475 and 1476. The Darb-e-Imam also dates from this time.
Ouzun Hassan, whose capital was at Tabriz, also received envoys from the Venetians who wanted his help in their wars with the Turks. The envoy they sent reported that his army at that time amounted to 50,000
After Ouzun Hasan's death in 1478 a period of civil war broke out between his two sons, Khalil and Ya'qub. Ya'qub finally triumphed over his brother and held Isfahan from 1479 to 1490. He was
followed by his son Baysunghur who in turn was deprived of his power in 1493 by his cousin Rustam who died in 1497. The last of the Aq-Quiunlu, Alvand, was defeated in 1501 by his distant cousin Shah Ismail, who founded the Safavid dynasty.