In 1686 Thököly was released from his dungeon and sent with a small army into Transylvania, but both this expedition and a similar one in 1688 ended in failure. The Turks then again grew suspicious of him and imprisoned him a second time. In 1690, however, they dispatched him into Transylvania a third time with 16,000 men, and in September he routed the united forces of Gen. Donat Heissler and Count Mihály Teleki at Zărneşti. After this great victory Thököly was elected prince of Transylvania by the Kereszténysziget (probably Oprişani now) Diet, but could not maintain his position for long against the imperial armies. In 1691 he quit Transylvania altogether. He led the Turkish cavalry at the Battle of Slankamen and served valiantly but vainly against Austria during the remainder of the war, especially distinguishing himself at the Battle of Zenta (1697).