Selim III was the sultan of the Ottoman Empire from 1789 to 1807. Regarded as an enlightened ruler, he was eventually deposed and imprisoned by the Janissaries, who placed his cousin Mustafa on the throne as Mustafa IV (r. 1807–1808). A group of assassins subsequently killed Selim.