locally dominated by semi-autonomous Arab tribes like the Al-Mughamis, Musha'sha', and Muntafiq. Under them, the Emirate of Basra in southern Iraq often challenged the dynasties of Iran, until the Safavids subdued Basra in the early 16th century. Early modern era Despite decades of Iranian suzerainty, the Muntafiq remained autonomous and allied with the Ottomans and Portuguese. Iran briefly reoccupied Muntafiq Iraq between 1623 and 1639. By 1667, the Afrasiyab dynasty became co-rulers of southern Iraq with the Muntafiq while Ottoman suzerainty was disrespected. In 1667 the pasha of southern Iraq offered to submit to Iran, but the Safavids had no wish to antagonize the Ottomans. Similarly, the Iranians suppressed a Muntafiq revolt against Ottoman suzerainty in 1697, and returned Basra to the Ottomans in 1701. Nonetheless, Iraq was always a place of great importance to Iranians because of the abundant Shia shrines. In the early 18th century, Iraq became unified under the Mamluks, and they assisted the Ottomans with their invasion of Iran in the 1720s. In turn, the Iranians invaded Iraq three times between 1730 and 1776. Both countries had conflicting interests over the Kurdish emirates. In 1802, the Shah of Iran, Fath Ali Shah, criticized the Mamluk governor of Iraq for his inability to counter the anti-Shia Wahhabis. Iran and Iraq invaded each other again during the 1820s, before the Ottomans ended Iraqi autonomy in 1831. Modern era Pahlavi era Since the Ottoman–Persian Wars of the 16th and 17th centuries, Iran (known as "Persia" prior to 1935) and the Ottomans fought over Iraq (then known as Mesopotamia) and full control of the Shatt al-Arab until the signing of the Treaty of Zuhab in 1639 which established the final borders between the two countries. The Shatt al-Arab was considered an important channel for both states' oil exports, and in 1937, Iran and the newly independent Iraq signed a treaty to settle the dispute. In the same year, Iran and Iraq both joined the Treaty of Saadabad, and relations between the two states remained good for decades afterwards. The 1937 treaty recognised the Iran–Iraq border to be along the low-water mark on the Shatt al-Arab's eastern side, except at Abadan and Khorramshahr, where the frontier ran along the thalweg (deepest part of the river valley). This gave Iraq control of most of the waterway and required Iran to pay tolls whenever its ships used it. In 1955, both nations joined