Following the various non-Iranian dynasties that ruled in Iran, the first Iranian dynasty that could partly revert the country to the borders of the Sasanian era was the Safavid dynasty. Safavids consider themselves the descendants of Sheikh Safi ad-Din Ardabili, the founder of Sufism in Ardabil. Ismail was one of the Sufis who formed armies to take Azerbaijan (current Republic of Azerbaijan) from Aq Qoyonlus and found the Safavid Empire, and during the 10 years, he had conflicts with other claimants to subjugate all of Iran regions under the command of Safavid dynasty.
Safavid was a religious empire because Ismail and his deputies considered themselves descendants of Imam Ali (the first Shiite Imam). The troops under the command of the Safavid Empire, Qizilbash, or Red Hats that they were religious followers in addition to political obedience. After a while, the Shia religion became widespread in Iran. Due to the fact that the main rival of the Safavids was the Ottoman dynasty, and the official religion of Ottomans was Sunnis, the Safavids decided to turn it into a national identity by declaring Shiite religion as the official religion.
From the eastern side of the Safavids dominated lands, they were not allowed Uzbeks to infiltrate, but they had a fragile position in the West because of their Western rival, the Ottomans, they were at the peak of their military power, in the most important war between the Safavid Empire and the Ottomans, the battle of Chaldiran, the Safavids were defeated, consequences of this war was fell Baghdad and Azerbaijan to the Ottomans, and the Safavids inevitably moved their capital from Tabriz to Qazvin and then to Isfahan.
The reign of Shah Abbas I was the peak of the political and military power of the Safavid Dynasty. The magnificent architecture of the monuments built at the time of this king can be seen in Isfahan, Shah Abbas I kicked out the Ottomans from Azerbaijan and consolidated Iran’s dominance over the Persian Gulf. He arranged a series of European trade and developed cultural relations. In the era of the last Safavid king, Sultan Husayn, the warden of the Safavids in Afghanistan, declared independence and found Hotaki Dynasty, due to the weakness of the Safavids in their last years, the son of the warden of Afghanistan named Mahmud Hotak attacked to Iran and exterminate the Safavid Empire.