The Ottoman-Safavid War  was one of the many wars between the neighboring arch rivals of Safavid Persia and the Ottoman Empire. Starting with several years prior to the war and up to including most of the war itself, the Safavids were experiencing significant domestic issues and rivalling noble factions within the court since the death of Shah Tahmasp I. The Ottomans decided to declare war in 1577-1578 to exploit the chaos. The war, despite swift Ottoman victories in the first few years and large amounts of support from the Ottoman vassal Crimean Khanate during several stages of the war,, eventually turned being geo-politically and military relatively stale for several years with both parties losing and winning smaller battles till around 1580. It eventually had a turning point following the Battle of Torches on May 7-11, 1583 and the assassination of the Safavid generals Mirza Salman Jaberi and Hamza Mirza. Following these turns of events and internal chaos in the Safavid state, the Ottomans headed towards the eventual victory in 1590.
Question: Which happened first, the death of Shah Tahmasp I, or the Ottoman declaration of war?
Answer: death of Shah Tahmasp I