The Hungarian nobles rebelled in the late 1670s in Upper Hungary (Slovakia) and Mehmed IV thought it was the opportunity to kick the Habsburgs out of Hungary. Merzifonlu Kara Mustafa Pasha besieged Vienna thus alerting Jan III Sobieski to aid the Habsburgs as agreed before if Vienna or Krakow were besieged. And after the Ottomans were beaten while there was an alliance the pope decided it was time to kick the Ottomans out of Europe, thus an everlasting war (until 1699).