Osman II, convinced that the army, above all the Kapıkulu corps, and the order of the state in general had decayed, decided on reforms so radical that the society of that age could never have borne them. Despite his genius, his youth and inexperience prevented him from carrying them out. He was murdered (on the evening of 20 May 1622), and the Empire fell into turmoil as a result. The killing of the padishah, who was regarded as sacred, entered Turkish history as a kind of Karbala tragedy. The grief over it lasted for centuries. Part of the army and the people in various regions rose up to avenge Sultan Osman. Much blood was shed. In the end, only the anarchy grew and spread, and it turned into plain lawlessness. Mustafa I was again placed on the throne (1622-1623), but he was deposed. Osman II's brother and heir, the child Murad IV, became padishah (1623-1640). Just as his mother had acted as regent for Mustafa I, so for the child Murad IV his mother, Kösem Mahpeyker Valide Sultan, became regent of the sultanate. Anarchy and corruption increased more and more. Revolts followed one after another. Murad IV, raised in this climate, took power into his own hands with a harsh coup on 8 June 1632. He governed the state with a severity never seen in Ottoman history before or after him, one which it could easily be claimed bordered on tyranny, and he tolerated no authority other than his own person. Although he secured peace and order on a very wide scale and crushed the anarchy, later events showed that this achievement rested on the person of the padishah. Nevertheless, some historians say that Murad IV extended the life of the state by half a century. The greatest of the padishahs who came between Kanuni (Suleiman the Magnificent) and Mahmud II, he is a most distinguished figure of seventeenth-century Turkish history. He was born a genius and matured through events, yet the environment in which he lived and the things he witnessed drove him to tyranny. He was a great composer. Born a soldier, he was a personality endowed with the abilities to lead and command the greatest armies. His death at the age of 27.5 shook the state badly.
In the reign of Murad IV the Iranian wars reached dimensions never seen before and never to be seen again. The war began with Baghdad falling into the hands of the Safavids by surprise (on the night of 11/12 January 1624). When Hafız Ahmed Pasha failed to recapture Baghdad (1625-1626), Hüsrev Pasha, who had become grand vizier, turned Iran upside down. He conquered Hamadan (9 June 1630) and many places in western Iran, but could not take Baghdad back.
Murad IV set out on his first campaign, known as the Revan (Yerevan) Campaign (28 March-27 December 1635). After crushing Iran in the north, he undertook, with very great preparations, a second campaign known as the Baghdad Campaign. He arrived before Baghdad on 15 November and took the city after very bloody battles (24 December 1638). He earned the title of Conqueror of Baghdad. The Treaty of Kasr-ı Şirin (Zuhab) (17 May 1639) put an end to this great and bloody war of doubtful results, which had lasted more than 15 years. This treaty drew today's Turkey-Iran and Turkey-Iraq borders, leaving Iraq within the Ottoman state, and divided the Caucasus between the Ottoman and Safavid empires.