Napoleon Bonaparte had invaded Egypt (landing 1 July 1798 at Aboukir and capturing Alexandria the next day) in order to damage Britain's trade and threaten India. Advancing towards Cairo, Napoleon defeated the Egyptian leader Murad Bey on 21 July at the Battle of the Pyramids, and finally took possession of the capital on the 25 July 1798. Napoleon was effectively cut off in Egypt by the British fleet, which defeated the French Fleet at the Battle of the Nile on 1 August 1798, and his situation worsened when the Ottoman Sultan, Selim III, declared war on France on 11 September.
One year after taking Cairo, and having failed to take Acre by siege (which would have denied the Ottoman Sultan, Selim III, a base in Syria from which he could attack French occupied Egypt), Napoleon marched back towards the capital only to find that an Ottoman force of around 8,000 men had landed at Aboukir. A key fort at Aboukir was retaken after a cavalry charge - roughly 2,000 Ottoman soldiers were killed, and another 4,000 drowned trying to reach their ships. The remainder sealed themselves up in Aboukir castle where they lasted a week under siege before surrendering. Napoleon's success, having lost less than a thousand men against the Ottoman, was short lived, and he slipped out of Egypt, passed the British Navy on 22 August.