Selim III was, however, thoroughly under the influence of French ambassador to the Porte Horace Sébastiani, and the fleet was compelled to retire without effecting its purpose. But the anarchy, manifest or latent, existing throughout the provinces proved too great for Selim III to cope with. The Janissaries rose once more in revolt, induced the Sheikh ul-Islam to grant a fetva against the reforms, dethroned and imprisoned Selim III, and placed his cousin Mustafa on the throne, as Mustafa IV (1807–08), on 29 May 1807.