Passage: Starting in 1514, for over a century the Ottoman Empire and Safavid Persia were engaged in almost constant warfare over control of the South Caucasus and Mesopotamia. The two states were the greatest powers of West Asia, and the rivalry was further fueled by dogmatic differences: the Ottomans were Sunnis, while the Safavids were staunchly Shia Muslims of the Qizilbash sect, and seen as heretics by the Ottomans.After the Battle of Chaldiran eliminated Safavid influence in Anatolia, during the war of 1532–55 the Ottomans conquered Arab Iraq, taking Baghdad in 1534 and securing recognition of their gains by the Treaty of Amasya in 1555. Peace lasted for two decades before another war began in 1578. The Persians were hard pressed, as the Ottoman advances were combined with an attack by the Shaybanids into Persian Khorasan. The war ended with the Treaty of Constantinople in 1590, with a clear Ottoman victory: the Ottomans occupied Georgia, Revan, and even the former Safavid capital, Tabriz.The new Persian Shah, Abbas I (reigned 1588–1629), reorganized his army, raising the new ghulam infantry in imitation of the Janissaries, conscripted from tens of thousands of mostly Circassians and Georgians armed with the best equipment and training, and bided his time. In 1603, he launched an offensive that retook Tabriz, Azerbaijan and Georgia in the same year. The Ottomans, distracted by wars with the Habsburg Monarchy in Europe, failed to offer effective resistance. By 1622, following a successful conclusion of the war against the Mughals, and encouraged by the internal turmoil within the Ottoman Empire that followed the murder of Sultan Osman II (r. 1618–22), Abbas resolved to attack the Ottoman possessions in Iraq.

Question: Who were the Ottoman empire at war against?
Safavid Persia