Muftizade Ahmed Pasha established himself at the mosque of Baybars, which the French had converted into a fortress, but was eventually besieged by Muhammad Ali and his Albanian troops in the citadel of Cairo and compelled to surrender.
Days later, Trabluslu Ali Pasha landed at Alexandria with a firman from the Ottoman Porte appointing him the new governor of Egypt, and assumed control of the remaining Turkish forces.
The troubles of Egypt were exacerbated by an insufficient flood of the Nile, resulting in great scarcity, aggravated by the onerous taxation the Mamluk beys were forced to resort to in order to pay their troops.
He received written instructions from the Ottoman sultan, which in an effort to sow dissension and mistrust between Muhammad Ali Pasha and his Mamluk allies, he sent to Cairo and caused to be circulated there.
The Ottoman sultan announced that the Mamluk beys could live peaceably in Egypt with annual pensions of fifteen purses and other privileges, provided the government returned to the hands of the Turkish governor.
Finding his advance blocked, reluctant to retreat with his forces to Alexandria, and being surrounded by the enemy in any case, Trabluslu Ali Pasha attempted to give battle, but his men refused to fight.
Trabluslu Ali Pasha was sent under an escort/ guard of forty-five men towards the Syrian frontier; about a week later, news was received that during a skirmish with some of his own soldiers, he had fallen mortally wounded.
Although their demands for pay had been the cause for Al-Bardisi's onerous levies that led to the public disturbances, Muhammad Ali Pasha's proclamation and concessions resulted in the Albanian forces gaining in popularity amongst the citizens, at the expense of the Mamluks.
Cairo was in a state of tumult, suffering severely from a scarcity of grain, as well as from the heavy exactions of the pasha to meet the demands of his troops, whose numbers had been augmented by a Turkish detachment.
On May 17, 1805, the sheikhs, with an immense concourse of the inhabitants, assembled in the vicinity of the governor's residence, and the ulema, amid the prayers and cries of the people, wrote a statement of the wrongs which they had endured under the administration of Hurshid Ahmed Pasha.
Muhammad Ali's strength lay in the popular support of the citizens of Cairo, who looked on him as a savior from their afflictions; and great numbers armed themselves, and with the sayyid Omar and the sheikhs at their head, commenced to patrol and guarding the city at night.
That night in Cairo presented a curious spectacle; many of the inhabitants, believing that this envoy would put an end to their miseries, fired off their weapons as they paraded the streets with bands of music.
The silahdar, imagining the noise to be a battle, marched in haste towards the citadel, while its garrison sallied forth and began throwing up entrenchments in the quarter of Arab al-Yesgr, but were repulsed by the armed inhabitants and the Albanian soldiers stationed there.
Soon thereafter, a squadron under the command of the Turkish high admiral arrived at Aboukir Bay, with dispatches from the Ottoman sultan confirming the former envoy's firman, and authorizing Muhammad Ali Pasha to continue to discharge the functions of governor of Egypt.
Muhammad Ali now possessed the title of Governor of Egypt, but beyond the walls of Cairo his authority was everywhere disputed by the forces of the Mamluk beys, who were joined by the army of the silahdar of Hurshid Ahmed Pasha, as well as many Albanians who had deserted from his ranks.
Falling back towards their companions, the Mamluks found the side streets blocked; and in that part of the main thoroughfare called Bain al-Kasrain they were caught between two fires.
Thus shut up in a narrow street, some sought refuge in the collegiate mosque Barkukia, while the remainder fought their way through the encircling cordon, abandoned their horses, and escaped over the city-wall on foot.
Two Mamluks had in the meantime succeeded, by great exertions, in giving the alarm to their comrades in the vicinity of the Al-Azhar Mosque, thus enabling that faction to escape by the eastern gate called Bib al-Ghoraib.
Among them were four beys, one of whom, driven to madness by Muhammad Ali's mockery, asked for a drink of water; but when his hands were untied that he might take the bottle, he snatched a dagger from one of the soldiers, rushed at the pasha, and fell covered with wounds.
The wretched captives were then chained and left in the court of the pasha's house; and on the following morning the heads of their comrades who had perished the day before were skinned and stuffed with straw before their eyes.
Al-Alfi offered his submission on the condition of the cession of the Fayum and other provinces; but this was refused, and that chief gained two successive but indecisive victories over Muhammad Ali Pasha's troops, many of whom deserted to the Mamluks.
This measure met with the opposition of Muhammad Ali, as well as the determined resistance of the majority of the Mamluks, who, rather than have al-Alfi at their head, preferred their present condition; for the enmity of al-Bardisi had not subsided, and he commanded the voice of most of the other beys.
Proceeding however with its plans, the Ottomans sent a naval squadron under Salih Pasha, shortly before appointed high admiral, which arrived at Alexandria on 1 July 1806 with 3,000 regular troops and a successor to Muhammad Ali, who was to receive the pashalik of Salonika.
He induced the ulema to sign a letter, praying the sultan to revoke the command for reinstating the beys, persuaded the chiefs of the Albanian troops to swear personal allegiance to him, and sent 2000 purses contributed by them to Istanbul.
Al-Alfi was at that time besieging Damanhur, and he gained a signal victory over the Pasha's troops; but the dissensions of the Mamluk beys squandered their last chance at regaining power.
Fortune continued to favor Muhammad Ali, for in the following month al-Bardisi died, aged forty-eight years; and soon after, a scarcity of provisions caused al-Alfi's troops to revolt and mutiny.
They reluctantly raised the siege of Damanhur, being in daily expectation of the arrival of a British army; and at the village of Shubra-ment, al-Alfi was struck by a sudden illness, and died on January 30, 1807, at the age of fifty-five.
The British resident, Major Missett, having urged the importance of taking Rosetta and Rahmaniya in order to secure supplies for Alexandria, General Fraser, with the concurrence of the admiral, Sir John Thomas Duckworth, detached the 31st regiment and the Chasseurs Britanniques, accompanied by some field artillery under Major-General Wauchope and Brigadier-General Meade.
The advance guard in Hamad, consisting of a detachment of the 31st, two companies of the 78th, one of the 35th, and De Rolls regiment, with a picquet of dragoons, the whole mustering 733 men, was surrounded and, after a gallant resistance, the survivors, who had expended all their ammunition, became prisoners of war.
At that point, some of the remaining Mamluks submitted, returned to Egypt, and settled in Cairo, while the rest, amounting to about 100 persons, fled in dispersed parties to the countries adjacent to Sennar.