شيخ الإسلام
On 6 February 1695, Ahmed II died, and after some hesitation, the new sultan Mustafa II dismissed Sürmeli Ali Pasha on 22 April 1695. There were several reasons for this. Mustafa suspected that Sürmeli Ali Pasha's candidate for the throne instead of him had been a younger prince and he further suspected that Sürmeli Ali Pasha was against his plan for commanding the army personally. Additionally, there was a power struggle between Sürmeli Ali Pasha and Feyzullah Efendi, the sultan's advisor (and later Shaykh al-Islām). Sürmeli Ali was accused of fraud and exiled to Çeşme (in modern-day İzmir Province, Turkey), but soon the sultan changed his mind and had Sürmeli Ali executed on 29 May 1695.