The "perpetual" peace between Poland and the Ottoman Empire started to crumble in the 1590s. Difficulties arose when Jan Zamoyski took advantage of the Ottoman–Habsburg war in Hungary to invade Moldavia in 1595, in the Moldavian Magnate Wars. The Treaty of Jaruga was signed in 1617, restraining Polish interventions in the Danubian principalities, but open conflict later erupted with the Polish–Ottoman War (1620–1621).