Osman II ascended the throne at the age of 14 as the result of a coup d'état against his uncle Mustafa I "the Intestable" (1617–18, 1622–23). Despite his youth, Osman II soon sought to assert himself as a ruler, and after securing the empire's eastern border by signing a peace treaty (Treaty of Serav) with Safavid Persia, he personally led the Ottoman invasion of Poland during the Moldavian Magnate Wars. Forced to sign a peace treaty with the Poles after the Battle of Chotin (Chocim) (which was, in fact, a siege of Chotin defended by the Lithuanian–Polish hetman Jan Karol Chodkiewicz) in September–October, 1621, Osman II returned home to Constantinople in shame, blaming the cowardice of the Janissaries and the insufficiency of his statesmen for his humiliation.