The Ottoman wars, the rivalry between Austria and Transylvania, and the frequent insurrections against the Habsburg Monarchy inflicted a great deal of devastation, especially in the rural areas. In the Austro-Turkish War (1663–1664) a Turkish army led by the Grand Vizier decimated Slovakia. Even so, Thököly's kuruc rebels from the Principality of Upper Hungary fought alongside the Turks against the Austrians and Poles at the Battle of Vienna of 1683 led by John III Sobieski. As the Turks withdrew from Hungary in the late 17th century, the importance of the territory composing modern Slovakia decreased, although Pressburg retained its status as the capital of Hungary until 1848 when it was transferred back to Buda.