In the Summer of 1805, Hafiz the Ottoman pasha of Niš, gathered an army to crush the Serbian rebels led by Milenko Stojković near the village of Ivankovac.
The battle ended with a Serbian victory and the death of the pasha, prompting Ottoman Sultan Selim III to declare jihad (holy war) against the Serbs.
In the 1790s, the Ottoman Sultan Selim III granted the Serbs in the Sanjak of Smederevo (central Serbia) the right to run their own affairs in exchange for their cooperation with the governor of Belgrade, Hadži Mustafa Pasha.
Serbian leader Karađorđe arrived with guns and reinforcements defeating and driving the Turks back to Niš, where Hafiz Pasha, seriously wounded during the battle, died as a result.
[4] Defeat in the battle prompted Selim to declare jihad (holy war) against the Serbian revolutionaries fighting to expel the Turks from Serbia.