Transylvania, the Eastern part of the former Hungarian Kingdom, gained semi-independence in 1526, while paying tribute to the Ottoman Empire. In 1657, Transylvania felt strong enough to attack the Tatars to the East (then the Empire's vassals), and later the Ottoman Empire itself, which had come to the Tatars' defence. The war lasted until 1662, ending in defeat for the Hungarians. The Western part of the Hungarian Kingdom ("Partium") was annexed and placed under direct Ottoman control. At the same time, there was another campaign against Austria between 1663 and 1664. Despite being defeated in the Battle of Saint Gotthard on 1 August 1664 by Raimondo Montecuccoli, the Ottomans secured recognition of their conquest of Nové Zámky in the Peace of Vasvár with Austria, marking the greatest territorial extent of Ottoman rule in the former Hungarian Kingdom.