In 1387, Timur ordered the complete massacre of Isfahan, reportedly killing 70,000 citizens. The Ilkhans and the Timurids soon came to adopt the ways and customs of the Iranians, surrounding themselves with a culture that was distinctively Iranian.
Early Modern Period:
By the 1500s, Ismail I of Ardabil established the Safavid Empire, with his capital at Tabriz.
Beginning with Azerbaijan, he subsequently extended his authority over all of the Iranian territories, and established an intermittent Iranian hegemony over the vast relative regions, reasserting the Iranian identity within large parts of Greater Iran. Iran was predominantly Sunni, but Ismail instigated a forced conversion to the Shia branch of Islam, spreading throughout the Safavid territories in the Caucasus, Iran, Anatolia, and Mesopotamia. As a result, modern-day Iran is the only official Shia nation of the world, with it holding an absolute majority in Iran and the Republic of Azerbaijan, having there the first and the second highest number of Shia inhabitants by population percentage in the world. Meanwhile, the centuries-long geopolitical and ideological rivalry between Safavid Iran and the neighboring Ottoman Empire led to numerous Ottoman–Iranian wars.
The Safavid era peaked in the reign of Abbas I (1587–1629), surpassing their Turkish arch-rivals in strength, and making Iran a leading science and art hub in western Eurasia.
The Safavid era saw the start of mass integration from Caucasian populations into new layers of the society of Iran, as well as mass resettlement of them within the heartlands of Iran, playing a pivotal role in the history of Iran for centuries onwards. Following a gradual decline in the late 1600s and the early 1700s, which was caused by internal conflicts, the continuous wars with the Ottomans, and the foreign interference (most notably the Russian interference), the Safavid rule was ended by the Pashtun rebels who besieged Isfahan and defeated Sultan Husayn in 1722.
In 1729, Nader Shah, a chieftain and military genius from Khorasan, successfully drove out and conquered the Pashtun invaders. He subsequently took back the annexed Caucasian territories which were divided among the Ottoman and Russian authorities by the ongoing chaos in Iran. During the reign of Nader Shah, Iran reached its greatest extent since the Sasanian Empire, reestablishing the Iranian hegemony all over the Caucasus, as well as other major parts of the west and central Asia, and briefly possessing what was arguably the most powerful empire at the time.
Nader Shah invaded India and sacked far off Delhi by the late 1730s. His territorial expansion, as well as his military successes, went into a decline following the final campaigns in the Northern Caucasus against then revolting Lezgins. The assassination of Nader Shah sparked a brief period of civil war and turmoil, after which Karim Khan of the Zand dynasty came to power in 1750, bringing a period of relative peace and prosperity.
Compared to its preceding dynasties, the geopolitical reach of the Zand dynasty was limited. Many of the Iranian territories in the Caucasus gained de facto autonomy, and were locally ruled through various Caucasian khanates. However, despite the self-ruling, they all remained subjects and vassals to the Zand king. Another civil war ensued after the death of Karim Khan in 1779, out of which Agha Mohammad Khan emerged, founding the Qajar dynasty in 1794.