In 1596 the Ottoman governor sold Basra to a certain Afrasiyab, a local magnate descended from the Sunni Seljuq dynasty.
From then until 1668, Basra was considered a hereditary eyalet under the Afrasiyab family.

During this period, the Safavid Shah Abbas the Great (r. 1588–1629) made a number of attempts to capture Basra, a major rival for his own commercial port city of Bandar Abbas, and a base for the Portuguese traders in the region.
The Safavid attempts in 1624, 1625, and 1628–1629 during the War of 1623–1639 proved unsuccessful, through a combination of Portuguese interference, pressing concerns on other fronts and, finally, Abbas' death.

Though the Safavids acknowledged Ottoman rule over Iraq in the Treaty of Zuhab (1639), they were occasionally tempted to attempt to regain it, for instance after the Ottoman defeat at Vienna in 1683.
More cautious and conservative factions, aware of the decline in Safavid military strength, prevailed against it.
Relations remained fraught around Basra due to the continuous harassment of Iranian pilgrims by the Ottoman authorities, so that the Safavids even prohibited the passage of pilgrims on several occasions.
Furthermore, upheavals in southern Iraq continued to spill over the border into Safavid territory.
Thus in 1667, when Husayn Pasha of the Afrasiyab dynasty refused to acknowledge the suzerainty of the Sultan and the Ottomans sent a punitive expedition against him, Husayn Pasha evacuated the entire population to Safavid territory while offering the city to the Safavids.
Shah Suleiman I (r. 1666–1694), however, dismissed Husayn Pasha's pleas as he did not want to antagonize the Ottomans, and in 1668, the Ottoman governor of Baghdad established direct control over Basra.

Basra was also drawn to the Safavids for economic reasons: in the mid to late 17th century, Safavid abbasi and panj shahi coins were the most commonly used coins in Basra.
Under Suleiman I's successor, Husayn (r. 1694–1722), Safavid policy in relation to regaining Iraq did not change.
Matthee claimed "this is hardly surprising", given that the Safavid army was weak at the time and the Shah himself was famous for his unassertive nature.
Unlike most of his predecessors, Sultan Husayn actively encouraged pilgrims to visit the Shi'ite holy shrines in Iraq, which they did in unprecedented numbers.
Husayn was also willing to spend the resources of the Safavid state for the upkeep of the shrines in Iraq.
In 1596 the Ottoman governor sold Basra to a certain Afrasiyab, a local magnate descended from the Sunni Seljuq dynasty. From then until 1668, Basra was considered a hereditary eyalet under the Afrasiyab family. 
During this period, the Safavid Shah Abbas the Great (r. 1588–1629) made a number of attempts to capture Basra, a major rival for his own commercial port city of Bandar Abbas, and a base for the Portuguese traders in the region. The Safavid attempts in 1624, 1625, and 1628–1629 during the War of 1623–1639 proved unsuccessful, through a combination of Portuguese interference, pressing concerns on other fronts and, finally, Abbas' death.
Though the Safavids acknowledged Ottoman rule over Iraq in the Treaty of Zuhab (1639), they were occasionally tempted to attempt to regain it, for instance after the Ottoman defeat at Vienna in 1683. More cautious and conservative factions, aware of the decline in Safavid military strength, prevailed against it. Relations remained fraught around Basra due to the continuous harassment of Iranian pilgrims by the Ottoman authorities, so that the Safavids even prohibited the passage of pilgrims on several occasions. Furthermore, upheavals in southern Iraq continued to spill over the border into Safavid territory. Thus in 1667, when Husayn Pasha of the Afrasiyab dynasty refused to acknowledge the suzerainty of the Sultan and the Ottomans sent a punitive expedition against him, Husayn Pasha evacuated the entire population to Safavid territory while offering the city to the Safavids. Shah Suleiman I (r. 1666–1694), however, dismissed Husayn Pasha's pleas as he did not want to antagonize the Ottomans, and in 1668, the Ottoman governor of Baghdad established direct control over Basra.
Basra was also drawn to the Safavids for economic reasons: in the mid to late 17th century, Safavid abbasi and panj shahi coins were the most commonly used coins in Basra. Under Suleiman I's successor, Husayn (r. 1694–1722), Safavid policy in relation to regaining Iraq did not change. Matthee claimed "this is hardly surprising", given that the Safavid army was weak at the time and the Shah himself was famous for his unassertive nature. Unlike most of his predecessors, Sultan Husayn actively encouraged pilgrims to visit the Shi'ite holy shrines in Iraq, which they did in unprecedented numbers. Husayn was also willing to spend the resources of the Safavid state for the upkeep of the shrines in Iraq.
Safavid occupation of Basra