Part of the Garnier Expedition
The Battle of Hanoi was fought on 20 November 1873 between France and Đại Nam. A French expeditionary force composed of 140 sailors, 30 marines and 8 officers under the command of Navy Lieutenant Francis Garnier captured the provincial capital Hanoi, where they had been sent by France on a diplomatic mission, without superiors' orders. 
The capture of the city became the starting point of an unsanctioned military campaign by Lieutenant Garnier and his men, who then proceeded to conquer most of the Bắc Kỳ region over the course of December 1873.
Background.
In late summer 1873, a dispute between French trader Jean Dupuis and the authorities of Hanoi was on the verge of causing a diplomatic crisis between France and Đại Nam. Imperial authorities in Huế required from France that they took action to remove Dupuis from Bắc Kỳ.
Navy Lieutenant Francis Garnier was sent to Hanoi with two gunboats and 180 men in order to convince Dupuis to leave Bắc Kỳ and bring him back to Nam Kỳ. The small French force arrived to Hanoi on 5 November 1873. However, Garnier was soon very displeased with the way the local authorities treated him. After discussing with Dupuis, he became convinced that the trader's complains were justified while those of the Governor of Hanoi were not. When he attempted to discuss Dupuis' griefs with an Imperial mandarin, Garnier was told to know his place as a low ranking naval officer not habilitated to discuss important political matters. Forsaking his mission to bring back Dupuis, Garnier took the decision to capture the city.
Battle.
Preparations.
Garnier had tasked Second lieutenant of Marines Edgard de Trentinian with drawing a detailed map of the city's fortifications. For several days Trentinian walked along the walls, observing every detail, in order to draw something as accurate as possible. Garnier was very pleased with the young officer's work and used the map to carefully plan every single aspect of the city's storming.
A few days before the attack, Garnier strategically placed his two gunboats, "Scorpion" and "Espingole", about 1,200 meters away from the walls. The ships had been anchored on a position he had deemed as being the best to fire on the citadel without being endangered by Vietnamese cannons. On 19 October, the guns of the ships had all been perfectly pointed to the specific targets chosen by Garnier. Due to most of the gunboats crews being needed on land for the storming, the ammunition for the ships guns were all gathered near the guns so that the gunners, the only men who would be left on the ships, would not waste any time to go fetch rounds.
On the eve of the attack, Lieutenant Garnier gathered the seven other officers of his expeditionary force: Ensign Charles Esmez (aged 26), Ensign (aged 28), Ensign (aged 24), Aspirant Marc Hautefeuille (aged 21), Aspirant (aged 21), Aspirant George Bouxin (aged 20) and Second lieutenant Edgard de Trentinian of the 4th Marine Infantry Regiment (aged 22). Garnier proceeded to meticulously explain to each of them his plan and what their own task was. Jean Dupuis insisted to take part in the storming with his Chinese mercenaries and, although very reluctant about it, Garnier eventually gave in.
Before going to sleep, Garnier wrote to his brother:
Storming of the city.
On the morning of 20 October, French troops woke up at 5:00 am and, after briefly eating some soup, they got ready for the attack which was planned for 6:00 am. A first column composed of 30 sailors and one cannon under the leadership of Ensign Bain left the camp at 5:30 am and stealthily moved toward the South-Western gate. Lieutenant Garnier left shortly afterward, alongside a second column composed of 27 marines under Second Lieutenant Trentinian and 48 sailors with 4 cannons under Ensign Esmez. This second column was directed toward the South-Eastern gate. A certain number of men, mostly sick ones, were left to guard the camp.
After having removed some "chevaux-de-frise", Ensign Bain and his men took the redan which protected the South-Western gate. Following, the gunners positioned the cannon and started firing on the thick door. In the meantime, Bain's sailors, protected by covered positions, suppressed Vietnamese fire from the wall. The wall's cannons attempted to fire but the rounds flew well above the heads of the small French squad. As the wall's cannons were placed "en barbette" rather than inside embrasures, the gunners were not protected and many of them fell to the deadly fire of French Chassepot rifles. Besides their low quality archaic rifles and cannons that they fired without accuracy, the defenders also used various extremely outdated tactics, such as throwing nails from the top of the walls in hope to harm the feet of the attackers, which quite perplexed the French whose military boots rendered the manoeuvre completely useless. After having blown up the gate and routed the defenders, Bain's men occupied the South-Western entrance.
The two French gunboats had been put under the leadership of Ensign Balny d'Avricourt. Only 14 men were on board the "Scorpion" and 23 men were on board the "Espingole". As soon as they heard the first sounds of the battle, the two gunboats unleashed a devastating artillery fire on the Northern and Western gates, as well as the portion of the wall in between them.
At the South-Eastern gate, Garnier's party with their four cannons had brutally silenced the wall. The sailors and marines, from covered positions, made use of a very effective suppressive fire on the defenders, while the cannons blew up the Vietnamese artillery pieces located on the fortification. When General Tri Phương, who was leading from the front, got severely injured and had to be taken away from the action, the already low Vietnamese morale completely collapsed. Despite their four cannons however, the French had some difficulties destroying the thick door. When a breach was made at the top of it, an impatient Garnier climbed to rush inside, followed only by Trentinian and two marines. This marked the beginning of a general rout, as the already demoralized defenders gave up all hope and ran. A large number of Vietnamese soldiers fled through the Northern gate and ran away in panic across the rice fields. Garnier had remained near the entrance with his three men until the rest of his troops finally blew up the door and entered the place. Once everyone was inside, Garnier, who was concerned about the potential escape of important officials, sent a detachment under Aspirant Hautefeuille to go occupy the Eastern gate from inside, and then directed himself to the South-Western gate to order Bain to do the same for the Western gate.
Dupuis and 30 of his mercenaries, who were commanded by a Greek adventurer and veteran of the Ever Victorious Army named Georges Vlavianos, had been tasked with guarding the Eastern gate from outside to ensure no high ranking official would flee through there. However, instead of merely guarding the gate, they ended up taking the redan and eventually stormed inside. At the turn of a street, they crossed the path of the detachment which was being led by Hautefeuille toward the Eastern gate. The French mistook the Chinese mercenaries for Vietnamese troops and opened fire. They realized their mistake a few seconds later, but one of the mercenaries had been fatally shot and thus became the only "French" casualty of the battle. Shortly before 7:00 am, Ensign Esmez and his sailors took control of the citadel's great tower and hoisted the French flag at the top. This was the signal for the two gunboats to stop firing.
Vietnamese casualties were relatively heavy, with over 80 dead and 300 wounded. Nguyễn Lâm, the second son of Nguyễn Tri Phương and son-in-law of Emperor Thiệu Trị, was among the killed. General Tri Phương, though badly wounded to the hip by grapeshot, had attempted to escape on a horse but was captured by the French. An additional 2,000 Vietnamese troops, who had been unable to escape in time and had thus hidden in the corridors of the citadel, were subsequently disarmed and captured. To avoid any risk of desperate last stand action from their numerous cornered foes, the French took great care to explain them that they wouldn't be executed as prescribed for captured enemies by the local customs of warfare in the region at the time. Logistically unable to care for so many prisoners with so few men, the French released most of them a few days later and kept only the high ranking officers and dignitaries.
Aftermath.
With about 200 men and without any such orders, Lieutenant Garnier had captured the capital of Bắc Kỳ region, a city of roughly 80,000 inhabitants. Following the capture of Hanoi, Garnier appointed new mandarins and declared the Red River to be open to trade. Then, with his 180 men and the two gunboats, he initiated a striking military campaign that resulted in the conquest of most of Bắc Kỳ between late November and December 1873.
Despite being treated with respect by the French, General Tri Phương refused to have his wounds tended to and died on 20 December after undergoing a hunger strike. Garnier was killed in action one day later on 21 December while pursuing, with 18 of his men, a 600-man strong Black Flag force he had just routed away from the city's walls with a cannonade. The city nonetheless remained in French hands until February 1874, when a second French expedition sent to mitigate the consequences of Garnier's rogue campaign came to fetch the men and bring them back to Saigon.
References.
 ;templatestyles src="Reflist/styles.css" / ;