Treaty of Karlowitz
It is not clear why Selim chose to leave the throne. He retired to an esate near Silivri. His departure roughly coincided with the Treaty of Karlowitz (1699) which ended the Great Turkish War and the Treaty of Constantinople (1700) which ended Russian involvement in the same war.