In the aftermath of the Moldavian Magnate Wars (1595–1621) with the Polish-Lithuanian Commonwealth and the Habsburgs, culminating in the battles of Cecora and Ottoman defeat at Khotyn, the Janissaries resist attempts to reorganize the army and in 1622 kill Sultan Osman II when he plans to replace them.