Ottomans and Safavids fought over the fertile plains of Iraq for more than 150 years. After the capture of Baghdad by Ismail I, Suleiman I (the Magnificient) regained this city in 1534. After several campaigns, Safavids recaptured Baghdad in 1623 and lost it again to Murad IV in 1638, during which time, a permanent border was established by treaties, which is still valid between present Turkey and Iran.
Gradually declining in 17th and early 18th century, the Safavid rule ended in 1722, after the execution of Shah Sultan Hosain by an Afghan rebel army led by Mir Mahmud, who opposed to be converted from sunnite to shia Muslim.
After an interregnum period of almost 70 years, Nadir Shah prevented the occupation of Iran by Ottoman and Russian armies. The empire finally collapsed after his assassination in 1747 and was soon replaced by another Turkic dynasty Qajars in 1794.
Safavid Shahs of Persia
See also: Iranian monarchy