Thököly materially assisted the Turks in the Battle of Vienna in 1683, and shared the fate of the gigantic Turkish army. The Turkish Grand Vizier nevertheless laid the blame for the Turkish defeat in Vienna on Thököly, who thereupon hastened to Edirne to defend himself before the Turkish Sultan. Shortly afterwards, perceiving that the Turkish cause was now lost, he sought the mediation of Polish king John III Sobieski to reconcile him with the Emperor, offering to lay down his arms if the Emperor would confirm the religious rights of the Protestants in Hungary and grant him, Thököly, Upper Hungary (more exactly, 13 northeastern counties of Royal Hungary) with the title of prince. Leopold refused these terms and demanded an unconditional surrender. Thököly then renewed the war. However, the campaign of 1685 was a series of disasters, he was defeated at Prešov (Eperjes) and when he sought help from the Turks at Nagyvárad they seized him and sent him in chains to Edirne (possibly because of his previous negotiations with Leopold), whereupon most of his followers made their peace with the Emperor.