In the 11th century Turkic tribes started to immigrate to Iran. They settled primarily in the northwest. The Seljuk Turks defeated local rulers and established dynasties that ruled over most of the country until the Mongol invasions in the 13th century. The Mongols destroyed major cities such as Hamadan, Ardabil, Maragheh, Neyshabur, and Qazvin, and they killed almost all of the inhabitants as punishment for resistancet. The largest and most important cities in Iran, Ray, and Tus were destroyed by the Mongols. They devastated many regions, especially Khorasan and Mazandaran, by destroying irrigation networks and cropland.
The harsh rule of the Mongols caused a economic decline throughout the 13th century.
The Iran's Mongol rulers, followers of shamanism or Buddhism, did not accept the Islamic faith. Their official indifference or open hostility toward Islam stimulated the transformation of Sufi brotherhoods into religious paramilitary organizations. In 1295 Mongol ruler Ghazan Khan, himself a convert to Islam, restored Islam as the state religion. Ghazan and his followers also adopted policies that reversed Iran's economic decline. In the late 13th and early 14th centuries, cities that had escaped the destruction of the Mongol invasions, such as Esfahan, Shiraz, and Tabriz, emerged as new centers of cultural development.
However, from 1335 to 1380 civil strife weakened central authority. Between 1381 and 1405 invasions by Turkic conqueror Tamerlane destroyed more of Iran's cities and undid most of the progress Ghazan had achieved.