This period of renewed assertiveness came to a calamitous end in May 1683 when Grand Vizier Kara Mustafa Pasha led a huge army to attempt a second Ottoman siege of Vienna in the Great Turkish War of 1683–1687. The final assault being fatally delayed, the Ottoman forces were swept away by allied Habsburg, German and Polish forces spearheaded by the Polish king Jan III Sobieski at the Battle of Vienna. The alliance of the Holy League pressed home the advantage of the defeat at Vienna, culminating in the Treaty of Karlowitz (26 January 1699), which ended the Great Turkish War. The Ottomans surrendered control of significant territories, many permanently. Mustafa II (1695–1703) led the counterattack of 1695–96 against the Habsburgs in Hungary, but was undone at the disastrous defeat at Zenta (in modern Serbia), 11 September 1697.
If it is possible to answer this question, answer it for me (else, reply "unanswerable"): What treaty was signed 26 January 1699?
Treaty of Karlowitz