The Second Egyptian-Ottoman War was fought between the Ottoman Empire and its Egypt Eyalet, which attempted to declare independence from Istanbul. The war resulted in the Ottoman reconquest of Syria from the Egyptians.
After the end of the First Ottoman-Egyptian War in 1833, Egypt received Crete, Hejaz, and Syria from the Ottoman Empire in exchange for Muhammad Ali becoming a nominal vassal of the Ottoman sultan. However, the Sultan was concerned that Muhammad Ali was not content with his gains, and he offered him hereditary rule in Egypt and Arabia if he withdrew from Syria and Crete and renounced any desire for full independence. Muhammad Ali rejected the offer, and, on 25 May 1838, Muhammad Ali informed Britain and France that he intended to declare independence from the Ottoman Empire, a decision that was contrary to their desire to maintain the balance of power. By then, the Egyptians built up a sizeable force in Syria while the Ottomans prepared for war.
Upon hearing of Muhammad Ali's plan to declare independence, Sultan Mahmud II declared him a traitor and sent an army to invade Syria. Ibrahim attacked and destroyed them at the Battle of Nezib on 24 June 1839, and the Ottoman Navy proceeded to defect to the Egyptians. Mahmud II died almost immediately after the disaster at Nezib, but Muhammad Ali and his son Ibrahim Pasha differed over whether to conquer Istanbul or whether to demand territorial concessions and autonomy. The Oriental Crisis of 1840 set in as Britain, Austria, Prussia, and Russia attempted to persuade Muhammad Ali to accept hereditary rule of Egypt as part of the Ottoman Empire if h e withdrew from Syria and Mount Lebanon. Muhammad Ali hesitated, believing he had support from France, but King Louis Philippe I backed down, as he was already entangled in the Rhine crisis with the German Confederation.
The British Royal Navy's Mediterranean Fleet, led by Admiral Sir Robert Stopford, promptly dispatched Commodore Charles Napier to the Lebanese coast with a small squadron. On 11 August, Napier attempted to persuade the Egyptian governor Soliman Pasha al-Faransawi to abandon Beirut and leave Syria, but the Egyptians' 15,000 troops far outnumbered his own command. On 11 September, after being joined by Stopford's ships, Napier bombarded Beirut and landed at Jounieh with 1,500 Turks and Royal Marines. A Beiruti revolt prevented Ibrahim Pasha from doing more than trying to hold the coastal cities. A British-Turkish-Austrian fleet also bombarded Sidon on 26 September and captured the city within two days. On 3 October, the Egyptians abandoned Beirut, leaving Acre as the only coastal position in Egyptian hands. The British-Austrian-Turkish fleet bombarded Acre on 4 November, destroying the main magazine and killing 1,100 men in the ensuing explosion. With 18 dead and 41 wounded, the British occupied Acre. Stopford then sent Napier to command the squadron at Alexandria, which he blockaded on 25 November. He personally negotiated peace with Muhammad Ali, guaranteeing him hereditary rule over Egypt if he renounced all claims to Syria, submitted to the Sultan, and returned the Ottoman fleet. Stopford and the British ambassador were infuriated with the outcome, but the treaty later confirmed by the Sultan used Napier's original as the basis for negotiations. Egypt returned Syria, Crete, and the Hejaz to the Ottoman Empire in exchange for the recognition of Muhammad Ali and his sons as being the only legitimate rulers of Egypt.