e undefended outskirts of Shanghai were occupied by the British on 19 June. Following the battle, Shanghai was looted by retreating Qing banner-men, British soldiers, and local civilians. Qing Admiral Chen Huacheng was killed while defending a fort in Woosong.
The fall of Shanghai left the vital city of Nanjing (Known as Jiangning under the Qing) vulnerable. The Qing amassed an army of 56,000 Manchu Banner-men and Han Green Standards to defend Liangjiang Province, and strengthened their river defenses on the Yangtze. However, British naval activity in Northern China led to resources and manpower being withdrawn to defend against a feared attack on Beijing. The Qing commander in Liangjiang Province released 16 British prisoners with the hope that a ceasefire could be reached, but poor communications led both the Qing and the British to reject any overtures at peace. In secret, the Daoguang Emperor considered signing a peace treaty with the British, but only in regards to the Yangtze River and not the war as a whole. Had it been signed, the British forces would have been paid to not enter the Yangtze River.
On 14 July the British fleet on the Yangtze began to sail up the river. Reconnaissance alerted Gough to the logistical importance of the city of Zhenjiang (Chinkiang), and plans were made to capture it. Most of the city's guns had been relocated to Wusong and had been captured by the British when said city had been taken. The Qing commanders inside the city were disorganized, with Chinese sources stating that over 100 traitors were executed in Zhenjiang prior to the battle. The British fleet arrived off of the city on the morning of 21 July, and the Chinese forts defending the city were blasted apart. The Chinese defenders initially retreated into the surrounding hills, causing a premature British landing. Fighting erupted when thousands of Chinese soldiers emerged from the city, beginning the Battle of Zhenjiang.
British engineers blew open the western gate and stormed into the city, where fierce street to street fighting ensued. Zhenjiang was devastated by the battle, with many Chinese soldiers and their families committing suicide rather than be taken prisoner. The British suffered their highest combat losses of the war (36 killed) taking the city.
After capturing Zhenjiang the British fleet cut the vital Grand Canal, paralyzing the Caoyun system and severely disrupting the Chinese ability to distribute grain throughout the Empire. The British departed Zhenjiang on 3 August, intending to sail to Nanking. They arrived outside the Jiangning District on 9 August, and were in position to assault the city by 11 August. Although explicit permission to negotiate had not yet been granted by the emperor, Qing officials inside the city agreed to a British request to negotiate.
On 14 August a Chinese delegation led by the Manchu high court official Qiying (Kiying) and Llipu departed Nanking for the British fleet. Negotiations lasted for several weeks as the British delegation insisted the treaty be accepted by Daoguang Emperor. The court advised the emperor to accept the treaty, and on 21 August the Daoguang Emperor authorized his diplomats to sign the peace treaty with the British. The First Opium war officially ended on 29 August 1842 with the signing of the Treaty of Nanking. The document was signed by officials of the British and Qing empires aboard HMS Cornwallis.
The British military superiority during the conflict drew heavily on the success of the Royal Navy.
British warships carried more guns than their Chinese opponents and were maneuverable enough to evade Chinese boarding actions. Steam ships such as HMS Nemesis were able to move against winds and tides in Chinese rivers, and were armed with heavy guns and congreve rockets. Several of the larger British warships in China (notably the third-rates HMS Cornwallis, HMS Wellesley, and HMS Melville) carried more guns than entire fleets of Chinese junks. British naval superiority allowed the Royal Navy to attack Chinese forts with very little risk to themselves, as British