With the Treaty of Zuhab in 1639, most of the territory of present-day Iraq eventually came under the control of Ottoman Empire as the eyalet of Baghdad as a result of wars with the neighbouring rival, Safavid Iran. Throughout most of the period of Ottoman rule (1533–1918), the territory of present-day Iraq was a battle zone between the rival regional empires and tribal alliances.