Gia Long

Gia Long ( (North), (South) ; 8 February 1762 – 3 February 1820), born Nguyễn Phúc Ánh (阮福暎) or Nguyễn Ánh, was the founding emperor of the Nguyễn dynasty, the last dynasty of Vietnam. His dynasty would rule the unified territories that constitute modern-day Vietnam until 1945.

A nephew of the last Nguyễn lord who ruled over south Vietnam, Nguyễn Ánh was forced into hiding in 1777 as a fifteen-year-old when his family was slain in the Tây Sơn revolt. After several changes of fortune in which his loyalists regained and again lost Saigon, he befriended the French Catholic Bishop Pierre Pigneau de Behaine. Pigneau championed Nguyễn Ánh's cause to regain the throne to the French government and managed to recruit volunteers, however that soon fell through. From 1789, Nguyễn Ánh was once again in the ascendancy and began his northward march to defeat the Tây Sơn, reaching the border with the Qing dynasty by 1802, which had previously been under the control of the Trịnh lords. Following their defeat, he succeeded in reuniting Vietnam after centuries of internecine feudal warfare, with a greater landmass than ever before, stretching from the Qing's borders down to the Gulf of Siam.

Gia Long's rule was noted for its Confucian orthodoxy. He defeated the Tây Sơn rebellion and reinstated the classical Confucian education and civil service system. He moved the capital from Hanoi south to Huế as the country's populace had also shifted south over the preceding centuries, and built up several fortresses and a palace in his new capital. Using French expertise, he modernized Vietnam's defensive capabilities. In deference to the assistance of his French friends, he tolerated the activities of Roman Catholic missionaries, something that became increasingly restricted under his successors. Under his rule, Vietnam strengthened its military dominance in Indochina, expelling Siamese forces from Cambodia and turning it into a vassal state.

Early years
Born in Phú Xuân (modern-day Huế, central Vietnam) on 8 February 1762, he also had two other names in his childhood: Nguyễn Phúc Chủng (阮福種) and Nguyễn Phúc Noãn (阮福暖). Nguyễn Ánh was the third son of Nguyễn Phúc Luân and Nguyễn Thị Hoàn. Luan was the second son of Lord Nguyễn Phúc Khoát of southern Vietnam; the first son had already predeceased the incumbent Lord. There are differing accounts on which son was the designated successor. According to one theory, Luân was the designated heir, but a high-ranking mandarin named Trương Phúc Loan changed Khoat's will of succession on his deathbed, and installed Luan's younger brother Nguyễn Phúc Thuần, the sixteenth son, on the throne in 1765. Luan was jailed and died in the 1765, the same year as Thuan's installation. However, the historian Choi Byung Wook claims that the notion that Luân was the designated heir was based on fact but was propagated by 19th century Nguyễn dynasty historians after Nguyễn Ánh had taken the throne as Gia Long to establish the emperor's legitimacy. According to Choi, Lord Khoát had originally chosen the ninth son, who then died, leaving Loan to install Lord Thuần. At the time, the alternative was the eldest son of the ninth son, Nguyễn Phúc Dương, whom opposition groups later tried unsuccessfully to convince to join them as a figurehead to lend legitimacy. In 1775, Thuan was forced to share power with Dương by military leaders who supported the Nguyêns. At this time, Nguyễn Ánh was a minor member of the family and did not have any political support among court powerbrokers.

However, Thuan lost his position as lord of southern Vietnam and was killed, along with Duong, during the Tây Sơn rebellion led by the brothers Nguyễn Nhạc, Nguyễn Huệ and Nguyễn Lữ in 1777. Nguyễn Ánh was the most senior member of the ruling family to have survived the Tây Sơn victory, which pushed the Nguyễn from their heartland in central Vietnam, southwards towards Saigon and into the Mekong Delta region in the far south. This turn of events changed the nature of the Nguyễn power hierarchy; the family and the first leader Nguyễn Hoàng had originally come from Thanh Hoa Province in northern Vietnam, and this is where most of their senior military and civil leadership's heritage derived from, but as a result of the Tây Sơn's initial successes, much of this old power base was destroyed and Nguyễn Ánh had to rebuild his support network among southerners, who later became the core of the regime when the Nguyễn dynasty was established.

Nguyễn Ánh was sheltered by a Catholic priest Paul Nghi (Phaolô Hồ Văn Nghị) in Rạch Giá. Later, he fled to Hà Tiên on the southern coastal tip of Vietnam, where he met Pigneau de Behaine, a French priest who became his advisor and played a major part in his rise to power. Receiving information from Paul Nghi, Pigneau avoided the Tay Son army in Cambodia, and came back to assist Nguyễn Ánh. They hid in the forest to avoid the pursuit of Tay Son army. Together, they escaped to the island of Pulo Panjang in the Gulf of Siam. Pigneau hoped that by playing a substantial role in a Nguyễn Ánh victory, he would be in position to lever important concessions for the Catholic Church in Vietnam, helping its expansion in Southeast Asia. In late 1777, the main part of the Tây Sơn army left Saigon to go north and attack the Trịnh lords, who ruled the other half of Vietnam. Nguyễn Ánh stealthily returned to the mainland, rejoining his supporters and reclaimed the city of Saigon. He was crucially aided by the efforts of Do Thanh Nhon, a senior Nguyễn Lord commander who had organized an army for him, which was supplemented by Cambodian mercenaries and Chinese pirates. The following year, Nhon expelled additional Tây Sơn troops from the surrounding province of Gia Dinh and inflicted heavy losses on the Tây Sơn naval fleet. Taking advantage of the more favorable situation, Nguyễn Ánh sent a diplomatic mission to Siam to propose a treaty of friendship. This potential pact, however, was derailed in 1779 when the Cambodians rose up against their pro-Siamese leader Ang Non II. Nguyễn Ánh sent Nhon to assist the revolt, which eventually saw Ang Non II defeated decisively and executed.

Nhon returned to Saigon with high honor and concentrated his efforts on improving the Nguyễn navy. In 1780, in an attempt to strengthen his political status, Nguyễn Ánh proclaimed himself Nguyễn vương (Nguyễn king or Nguyễn ruler in Vietnamese) with the support of Nhon's Dông Sơn Army. In 1781, Nguyễn Ánh sent further forces to prop up the Cambodian regime against Siamese armies who wanted to reassert their control. Shortly thereafter, Nguyễn Ánh had Nhon brutally murdered. The reason remains unclear, but it was postulated that he did so because Nhon's fame and military success was overshadowing him. At the time, Nhon had much, if not dominant power, behind the scenes. According to later Nguyễn dynasty chronicles, Nhon's powers included that of deciding who would receive the death penalty, and allocating budget expenditures. Nhon also refused to allocate money for royal spending. Nhon and his men were also reported to have acted in an abrasive and disrespectful manner to Nguyễn Ánh.

The Tây Sơn brothers reportedly broke out in celebration upon hearing of Nhon's execution, as Nhon was the Nguyễn officer whom they feared the most. Large parts of Nhon's supporters rebelled, weakening the Nguyễn army, and within a few months, the Tây Sơn had recaptured Saigon mainly on the back of naval barrages. Nguyễn Ánh was forced to flee to Ha Tien, and then onto the island of Phu Quoc. Meanwhile, some of his forces continued to resist in his absence. While the murder of Nhon weakened Nguyễn Ánh in the short term, as many southerners who were personally loyal to Nhon broke away and counter-attacked, it also allowed Nguyễn Ánh to gain autonomy and then take steps towards exerting direct control over the remaining local forces of the Dong Son who were willing to work with him. Nguyễn Ánh also benefited from the support of Chau Van Tiep, who had a power base in the central highlands between the strongholds of the Nguyễn and the Tây Sơn.

In October 1782, the tide shifted again, when forces led by Nguyễn Phúc Mân, Nguyễn Ánh's younger brother, and Chau Van Tiep drove the Tây Sơn out of Saigon. Nguyễn Ánh returned to Saigon, as did Pigneau The hold was tenuous, and a counterattack by the Tây Sơn in early 1783 saw a heavy defeat to the Nguyễn, with Nguyen Man killed in battle. Nguyễn Ánh again fled to Phu Quoc, but this time his hiding place was discovered. He managed to escape the pursuing Tây Sơn fleet to Koh-rong island in the Bay of Kompongsom. Again, his hideout was discovered and encircled by the rebel fleet. However, a typhoon hit the area, and he managed to break the naval siege and escape to another island amid the confusion. In early-1784, Nguyễn Ánh went to seek Siamese aid, which was forthcoming, but the extra 20,000 men failed to weaken the Tây Sơn's hold on power. This forced Nguyễn Ánh to become a refugee in Siam in 1785. To make matters worse, the Tây Sơn regularly raided the rice-growing areas of the south during the harvesting season, depriving the Nguyễn of their food supply. Nguyễn Ánh eventually came to the conclusion that using Siamese military aid would generate a backlash among the populace, due to prevailing Vietnamese hostility towards Siam.

Pigneau and French assistance
Deflated by his situation, Nguyễn Ánh asked Pigneau to appeal for French aid, and allowed Pigneau to take his son Nguyễn Phúc Cảnh with him as a sign of good faith. This came about after Nguyễn Ánh had considered enlisting English, Dutch, Portuguese and Spanish assistance. Pigneau advised against Nguyễn Ánh's original plan to seek Dutch aid from Batavia, fearing that the support of the Protestant Dutch would hinder the advancement of Catholicism. Pigneau left Vietnam in December, arriving in Pondicherry, India in February 1785 with Nguyễn Ánh's royal seal. Nguyễn Ánh had authorized him to make concessions to France in return for military assistance. The French administration in Pondicherry, led by acting governor Coutenceau des Algrains, was conservative in outlook and resolutely opposed intervention in southern Vietnam. To compound the already complex situation, Pigneau was denounced by Spanish Franciscans in the Vatican, and he sought to transfer his political mandate to Portuguese forces. The Portuguese had earlier offered Nguyễn Ánh 56 ships to use against the Tây Sơn.

In July 1786, after more than 12 months of fruitless lobbying in Pondicherry, Governor de Cossigny allowed Pigneau to travel back to France to directly ask the royal court for assistance. Arriving at the court of Louis XVI in Versailles in February 1787, Pigneau had difficulty in gathering support for a French expedition in support of Nguyễn Ánh. This was due to the parlous financial state of the country prior to the French Revolution. Pigneau was helped by Pierre Poivre, who had previously been involved in seeking French commercial interests in Vietnam. Pigneau told the court that if France invested in Nguyễn Ánh and acquired a few fortified positions on the Vietnamese coast in return, then they would have the capability to "dominate the seas of China and of the archipelago", and with it, control of Asian commerce. In November 1787, a treaty of alliance was concluded between France and Cochinchina, the European term for southern Vietnam, in Nguyễn Ánh's name. Pigneau signed the treaty as the "Royal Commissioner of France for Cochinchina". France promised four frigates, 1,650 fully equipped French soldiers and 250 Indian sepoys in return for the cession of Poulo-Condore (Côn Đảo) and Tourane (Da Nang), as well as tree trade to the exclusion of all other countries. However, the freedom to spread Christianity was not included. However, Pigneau found that Governor Thomas Conway of Pondicherry was unwilling to fulfill the agreement; Conway had been instructed by Paris to determine when to organize the aid, if at all. Pigneau was thus forced to use funds raised in France to enlist French volunteers and mercenaries. He also managed to procure several shipments of arms and munitions from Mauritius and Pondicherry.

Meanwhile, the Royal Court of Siam in Bangkok, under King Rama I, warmly welcomed Nguyễn Ánh. The Vietnamese refugees were allowed to build a small village between Samsen and Bangpho, and named it Long-kỳ (Thai: Lat Tonpho). Ánh had stayed in Siam with a contingent of troops until August 1787. His soldiers served in Siam's war against Bodawpaya of Burma (1785–86). On 18 December 1786, Nguyễn Ánh signed a treaty of alliance with the Portuguese in Bangkok. In the next year, António (An Tôn Lỗi), a Portuguese from Goa, came to Bangkok, brought Western soldiers and warships to Ánh. This disgusted the Siamese and Ánh had to refuse the aid from Portuguese. After this incident, Ánh was no longer trusted by the Siamese.

Having consolidated their hold on southern Vietnam, the Tây Sơn decided to move north to unify the country. However, the withdrawal of troops from the Gia Dinh garrison weakened their hold on the south. This was compounded by reports that Nguyễn Nhạc was being attacked near Qui Nhơn by his own brother Nguyễn Huệ, and that more Tây Sơn troops were being evacuated from Gia Dinh by their commander Dang Van Tran in order to aid Nguyễn Nhạc. Sensing Tây Sơn vulnerability in the south, Nguyễn Ánh assembled his forces at home and abroad in preparation for an immediate offensive. Ánh secretly left Siam in the night, leaving a letter in his house, he decided to head for southern Vietnam by boat. As the Vietnamese refugees were preparing to leave, people nearby heard about it and reported it to Phraya Phrakhlang. Phraya Phrakhlang reported it to King Rama I and the Front Palace Maha Sura Singhanat. Sura Singhanat was extremely angry, he chased them personally. At dawn, Sura Singhanat saw Ánh's boat at the mouth of the bay. Finally, the Vietnamese escaped successfully. Ánh arrived at Hà Tiên then to Long Xuyên (Cà Mau), but he failed in his first attempt to recapture Gia Dinh, having failed to convince the local warlord in the Mekong Delta, Vo Tanh to join his assault. The following year, Nguyễn Ánh finally managed to persuade the warlord to join him but after having given his sister to the warlord as a concubine. He eventually succeeded in taking Mỹ Tho, made it the main staging point for his operations, and rebuilt his army. After a hard-fought battle, his soldiers captured Saigon on 7 September 1788. Eventually, Pigneau assembled four vessels to sail to Vietnam from Pondicherry, arriving in Saigon on 24 July 1789. The combined forces helped to consolidate Nguyễn Ánh's hold on southern Vietnam. The exact magnitude of foreign aid and the importance of their contribution to Gia Long's success is a point of dispute. Earlier scholars asserted that up to 400 Frenchmen enlisted,  but more recent work has claimed that less than 100 soldiers were present, along with approximately a dozen officers.

Consolidation of southern Vietnam
After more than a decade of conflict, Nguyễn Ánh had finally managed to gain control of Saigon for long enough to have time to start a permanent base in the area and prepare to build up for a decisive power struggle with the Tây Sơn. The area around Saigon, known as Gia Dinh, began to be referred to as its own region, because Nguyễn Ánh's presence was becoming entrenched, distinguishing and associating the area with a political base. Nguyễn Ánh's military was able to consolidate, and a civil service was reestablished. According to the historian Keith Taylor, this was the first time that the southern third of Vietnam was integrated "as a region capable of participating successfully in war and politics among Vietnamese speakers", which could "compete for ascendancy with all the other places inhabited by speakers of the Vietnamese language". A Council of High Officials consisting of military and civil officials was created in 1788, as was a tax collection system. In the same year, regulations were passed to force half the male population of Gia Dinh to serve as conscripts, and two years later, a system of military colonies was implemented to bolster the Nguyễn support base across all racial groups, including ethnic Khmers and Chinese.

The French officers enlisted by Pigneau helped to train Nguyễn Ánh's armed forces and introduced Western technological expertise to the war effort. The navy was trained by Jean-Marie Dayot, who supervised the construction of bronze-plated naval vessels. Olivier de Puymanel was responsible for training the army and the construction of fortifications. He introduced European infantry training, formations and tactics while also facilitating various methods of manufacturing and using European-style artillery, thereby making cannonry and projectiles a central part of the military. Pigneau and other missionaries acted as business agents for Nguyễn Ánh, purchasing munitions and other military matériel. Pigneau also served as an advisor and de facto foreign minister until his death in 1799. Upon Pigneau's death, Gia Long's funeral oration described the Frenchman as "the most illustrious foreigner ever to appear at the court of Cochinchina". Pigneau was buried in the presence of the crown prince, all mandarins of the court, the royal bodyguard of 12,000 men and 40,000 mourners.

Fortifications


Following the recapture of Saigon, Nguyễn Ánh consolidated his power base and prepared the destruction of the Tây Sơn. His enemies had regularly raided the south and looted the annual rice harvests, so Nguyễn Ánh was keen to strengthen his defence. One of Nguyễn Ánh's first actions was to ask the French officers to design and supervise the construction of a modern European-style citadel in Saigon. The citadel was designed by Theodore Lebrun and de Puymanel, with 30,000 people mobilized for its construction in 1790. The townsfolk and the mandarins were punitively taxed for the work and the laborers were so over-worked that they revolted. When finished, the stone citadel had a perimeter measuring 4,176 meters in a Vauban model. The fortress was bordered on three sides by pre-existing waterways, bolstering its natural defensive capability. Following the construction of the citadel, the Tây Sơn never again attempted to sail down the Saigon River and try to recapture the city, its presence having endowed Nguyễn Ánh with a substantial psychological advantage over his opponents. Nguyễn Ánh took a keen personal interest in fortifications, ordering his French advisors to travel home and bring back books with the latest scientific and technical studies on the subject. The Nguyễn royal palace was built inside the citadel.

Agricultural reform and economic growth
With the southern region secured, Nguyễn Ánh turned his attention to agricultural reforms. Due to Tây Sơn naval raids on the rice crop via inland waterways, the area suffered chronic rice shortages. Although the land was extremely fertile, the region was agriculturally underexploited, having been occupied by Vietnamese settlers only relatively recently. Furthermore, agricultural activities had also been significantly curtailed during the extended warfare with the Tây Sơn. Nguyễn Ánh's agricultural reforms were based around extending to the south a traditional form of agrarian expansion, the đồn điền, which roughly translates as "military settlement" or "military holding", the emphasis being on the military origin of this form of colonization. These were first used during the 15th-century reign of Lê Thánh Tông in the southward expansion of Vietnam. The central government supplied military units with agricultural tools and grain for nourishment and planting. The soldiers were then assigned land to defend, clear and cultivate, and had to pay some of their harvest as tax. In the past, a military presence was required because the land had been seized from the conquered indigenous population. Under Nguyễn Ánh's rule, pacification was not usually needed but the basic model remained intact. Settlers were granted fallow land, given agricultural equipment, work animals, and grain. After several years, they were required to pay grain tax. The program greatly reduced the amount of idle, uncultivated land. Large surpluses of grain, taxable by the state, soon resulted.

By 1800, the increased agricultural productivity had allowed Nguyễn Ánh to support a sizeable army of more than 30,000 soldiers and a navy of more than 1,200 vessels. The surplus from the state granary was sold to European and Asian traders to facilitate the importation of raw materials for military purposes, in particular iron, bronze, and sulfur. The government also purchased caster sugar from local farmers and traded it for weapons from European manufacturers. The food surplus allowed Nguyễn Ánh to engage in welfare initiatives that improved morale and loyalty among his subjects, thereby increasing his support base. The surplus grain was deposited in granaries built along the northward route out of Saigon, following the advance of the Nguyễn army into Tây Sơn territory. This allowed his troops to be fed from southern supplies, rather than eating from the areas that he was attempting to conquer or win over. Newly acquired regions were given tax exemptions, and surrendered Tây Sơn mandarins were appointed to equivalent positions with the same salaries in the Nguyễn administration.

Naval buildup
Nguyễn Ánh used his new Chu Su Naval workshop to improve his inferior navy, which was much smaller than the Tây Sơn fleet and hitherto unable to prevent their rice raids. Nguyễn Ánh had first attempted to acquire modern naval vessels in 1781, when on the advice of Pigneau, he had chartered Portuguese vessels of European design, complete with crew and artillery. This initial experience proved to be disastrous. For reasons that remain unclear, two of the vessels fled in the midst of the battle against the Tây Sơn, while angry Vietnamese soldiers killed the third crew. In 1789, Pigneau returned to Vietnam from Pondicherry with two vessels, which stayed in the Nguyễn service long-term. Over time, Vietnamese sailors replaced the original French and Indian crew under the command of French officers. These vessels became the foundation for an expanded military and merchant Nguyen naval force, with Nguyễn Ánh chartering and purchasing more European vessels to reinforce Vietnamese-built ships. However, traditional Vietnamese-style galleys and small sailing ships remained the mainstay of the fleet. By 1794, two European vessels were operating together with 200 Vietnamese boats against the Tây Sơn near Qui Nhơn. In 1799, a British trader by the name of Berry reported that the Nguyễn fleet had departed Saigon along the Saigon River with 100 galleys, 40 junks, 200 smaller boats, and 800 carriers, accompanied by three European sloops. In 1801, one naval division was reported to have included nine European vessels armed with 60 guns, five vessels with 50 guns, 40 with 16 guns, 100 junks, 119 galleys, and 365 smaller boats.

Most of the European-style vessels were built in the shipyard that Nguyễn Ánh had commissioned in Saigon. He took a deep personal interest in the naval program, directly supervising the work and spending several hours a day at the dockside. One witness noted "One principal tendency of his ambition is to naval science, as a proof of this he has been heard to say he would build ships of the line on the European plan." By 1792, fifteen frigates were under construction, with a design that mixed Chinese and European specifications, equipped with 14 guns. The Vietnamese learned European naval architecture by dismantling an old European vessel into its components, so that Vietnamese shipbuilders could understand the separate facets of European shipbuilding, before reassembling it. They then applied their newfound knowledge to create replicas of the boats. Nguyễn Ánh studied naval carpentry techniques and was said to be adept at it, and learned navigational theory from the French books that Pigneau translated, particularly Denis Diderot and Jean le Rond d'Alembert's Encyclopédie. The Saigon shipyard was widely praised by European travelers.

Despite his extensive reliance on French officers in matters of military technology, Nguyễn Ánh limited his inner military circle to loyal Vietnamese. The Frenchmen decried his refusal to take their tactical advice. Chaigneau reported that the Europeans continually urged Nguyễn Ánh to take the initiative and launch bold attacks against Tây Sơn installations. Nguyễn Ánh refused, preferring to proceed slowly, consolidating his gains in one area and strengthening his economic and military base, before attacking another. In the first four years after establishing himself in Saigon in 1788, Nguyễn Ánh focused on tightening his grip on the Gia Dinh area and its productive rice paddies, and although his forces exerted a degree on control over areas to the north such as Khanh Hoa, Phu Yen and Binh Thuan, their main presence in the northern areas were mainly through naval forces and not concentrated on land occupation. This was because those areas were not very fertile in terms of rice production and were often affected by famines, and occupying the land would have meant an obligation to feed the populace, putting a strain on resources. During this four-year period, Nguyễn Ánh sent missions to Siam, Cambodia and south to the Straits of Malacca and purchased more European military equipment.

Over time, Nguyễn Ánh gradually reduced the military role of his French allies on the battlefield. In the naval battle at Thi Nai in 1792, Dayot led the Nguyễn naval attack, but by 1801, a seaborne offensive in the same area was led by Nguyen Van Truong, Vo Duy Nguy and Lê Văn Duyệt, with Chaigneau, Vannier, and de Forsans in supporting positions. The infantry attack on Qui Nhơn in 1793 was conducted, according to Nguyen historiography, in cooperation with "Western soldiers". The same source recorded that by 1801, Nguyen operations in the same area were directed by Vietnamese generals, whereas Chaigneau and Vannier were responsible for organizing supply lines.

Unification of Vietnam
In 1792, the middle and the most notable of the three Tây Sơn brothers, Nguyễn Huệ Quang Trung, who had gained recognition as Emperor of Vietnam by driving the Lê dynasty and China out of northern Vietnam, died suddenly. Nguyễn Ánh took advantage of the situation and attacked northwards. By now, the majority of the original French soldiers, whose number peaked at less than 80 by some estimates, had departed. The majority of the fighting occurred in and around the coastal towns of Nha Trang in central Vietnam and Qui Nhơn further to the north in Bình Định Province, the birthplace and stronghold of the Tây Sơn. Nguyễn Ánh began by deploying his expanded and modernized naval fleet in raids against coastal Tây Sơn territory. His fleet left Saigon and sailed northward on an annual basis during June and July, carried by southwesterly winds. The naval offensives were reinforced by infantry campaigns. His fleet would then return south when the monsoon ended, on the back of northeasterly winds. The large European wind-powered vessels gave the Nguyễn navy a commanding artillery advantage, as they had a superior range to the Tây Sơn cannons on the coast. Combined with traditional galleys and a crew that was highly regarded for its discipline, skill and bravery, the European-style vessels in the Nguyễn fleet inflicted hundreds of losses against the Tây Sơn in 1792 and 1793.

In 1794, after a successful campaign in the Nha Trang region, Nguyễn Ánh ordered de Puymanel to build a citadel at Duyen Khanh, near the city, instead of retreating south with the seasonal northeasterly breeze. A Nguyen garrison was established there under the command of Nguyễn Ánh's eldest son and heir, Nguyễn Phúc Cảnh, assisted by Pigneau and de Puymanel. The Tây Sơn laid siege to Duyen Khanh in May 1794, but Nguyen forces were able to keep them out. Shortly after the siege ended, reinforcements arrived from Saigon and offensive operations against the Tây Sơn duly resumed. The campaign was the first time that the Nguyễn were able to operate in Tây Sơn heartland during an unfavorable season. The defensive success of the citadel was a powerful psychological victory for the Nguyễn, demonstrating their ability to penetrate Tây Sơn territory at any time of the year. The Nguyễn then proceeded to slowly erode the Tây Sơn heartland.

Heavy fighting occurred at the fortress of Qui Nhơn until it was captured in 1799 by Nguyen Canh's forces. However, the city was quickly lost and was not regained until 1801. The superior firepower of the improved navy played the decisive role in the ultimate recapture of the city, supporting a large overland attack. With the capture of their stronghold at Qui Nhơn, the vanquishing of the Tây Sơn was inevitable. In June, the central city of Huế, the former capital of the Nguyễn, fell and Nguyễn Ánh crowned himself emperor, under the reign name Gia Long. A common modern myth about this reign title is that was derived from Gia Định (Saigon) and Thăng Long (Hanoi) to symbolise the unification of northern and southern Vietnam, despite no contemporary evidence supporting this. He then quickly overran the north, with Hanoi captured on 22 July 1802. After a quarter-century of continuous fighting, Gia Long had unified these formerly fractious territories, ultimately leading what is now modern Vietnam and elevated his family to a position never previously occupied by any Vietnamese royalty. Vietnam had never before occupied a larger landmass. Gia Long became the first Vietnamese ruler to reign over territory stretching from China in the north, all the way to the Gulf of Siam and the Cà Mau peninsula in the south. Gia Long's then petitioned the Qing dynasty of China for official recognition, which was promptly granted. The French failure to honor the treaty signed by Pigneau meant Vietnam was not bound to cede the territory and trading rights that they had promised.

Due to a Tây Sơn massacre of ethnic Chinese, the Nguyễn were subsequently supported by most ethnic Chinese against the Tây Sơn. The Tây Sơn's downfall and defeat at the hands of Nguyễn Phúc Ánh was therefore due, at least in part, to the ethnic Chinese support given the Nguyễn.

Rule
Gia Long's rule was noted for its strict Confucian orthodoxy. Upon toppling the Tây Sơn, he repealed their reforms and reimposed classical Confucian education and civil service systems. He moved the capital from Hanoi in the north to Huế in central Vietnam to reflect the southward migration of the population over the preceding centuries. The Emperor built new fortresses and a palace in his new capital. Using French expertise, Gia Long modernized Vietnam's defensive capabilities and, in recognition of the assistance of his French friends, he permitted the activities of Catholic missionaries, something, however, which was less tolerated by his successors. Under Gia Long's rule, Vietnam strengthened its military dominance in Indochina, expelling Siam from Cambodia and turning it into a vassal state. Despite this, he was relatively isolationist in outlook towards European powers.

Renaming Vietnam
Gia Long decided to join the Imperial Chinese Tributary System. He sent an embassy to Qing China and requested to change his country's name to Nam Việt (南越). Gia Long explained that the word Nam Việt derived from An Nam (安南) and Việt Thường (越裳), two toponyms mentioned in ancient Chinese records that were located in northern and southern Vietnam respectively, to symbolize the unification of the country. The Qing Jiaqing Emperor of China refused his request because it had an identical name with the ancient kingdom of Nam Việt (Nanyue), and the territory of Nam Việt contained Liangguang which belonged to Qing China at that time. Instead, Jiaqing agreed to change it to Việt Nam (越南). Gia Long's Đại Nam thực lục contains the diplomatic correspondence over the naming.

However, Gia Long copied the Imperial Chinese system, basing it on the Chinese Confucian model and attempting to create a Vietnamese Imperial tributary system. In 1805, Gia Long used "Trung Quốc" (中國), the very same word and characters used to refer to China, as a name for Vietnam.

It was said "Hán di hữu hạn" (, "the Vietnamese and the barbarians must have clear borders") by the Gia Long Emperor (Nguyễn Phúc Ánh) when differentiating between Khmer and Vietnamese. Minh Mạng implemented an acculturation integration policy directed at minority non-Vietnamese peoples. Thanh nhân (清人 Qingren) was used to refer to ethnic Chinese by the Vietnamese while Vietnamese called themselves as Hán nhân (漢人 Hanren) in Vietnam during the 1800s under Nguyễn rule.

Administrative structure
During the war era, Nguyễn Ánh had maintained an embryonic bureaucracy in an attempt to prove his leadership ability to the people. Due to the incessant warfare, military officers were generally the most prominent members of his inner circle. This dependency on military backing continued to manifest itself throughout his reign. Vietnam was divided into three administrative regions. The old patrimony of the Nguyễn formed the central part of the empire (vùng Kinh Kỳ), with nine provinces, five of which were directly ruled by Gia Long and his mandarins from Huế. The central administration at Huế was divided into six ministries: Public affairs, finance, rites, war, justice, and public works. Each was under a minister, assisted by two deputies and two or three councilors. Each of these ministries had around 70 employees assigned to various units. The heads of these ministries formed the Supreme Council. A treasurer-general and a Chief of the Judicial Service assisted a governor-general, who was in charge of a number of provinces. The provinces were classified into trấn and dinh. These were in turn divided into phủ, huyện and châu. All important matters were examined by the Supreme Council in the presence of Gia Long. The officials tabled their reports for discussion and decision-making. The bureaucrats involved in the Supreme Council were selected from the high-ranking mandarins of the six ministries and the academies.

Gia Long handled the northern and southern regions of Vietnam cautiously, not wanting them to be jarred by rapid centralization after centuries of national division. Tonkin, with the administrative seat of its imperial military protector (quan tổng trấn) at Hanoi, had thirteen provinces (tổng trấn Bắc Thành), and in the Red River Delta, the old officials of the Le administration continued in office. In the south, Saigon was the capital of the four provinces of Cochinchina (tổng trấn Gia Định), as well as the seat of the military protector. The citadels in the respective cities directly administered their military defense zones. This system allowed Gia Long to reward his leading supporters with highly powerful positions, giving them almost total autonomy in ordinary administrative and legal matters. This system persisted until 1831–32, when his son Minh Mạng centralized the national government.

In his attempts to re-establish a stable administration after centuries of civil war, Gia Long was not regarded as being innovative, preferring the traditional administration framework. When Gia Long unified the country, it was described by Charles Maybon as being chaotic: "The wheels of administration were warped or no longer existed; the cadres of officials were empty, the hierarchy destroyed; taxes were not being collected, lists of communal property had disappeared, proprietary titles were lost, fields abandoned; roads bridges and public granaries had not been maintained; work in the mines had ceased. The administration of justice had been interrupted, every province was a prey to pirates, and violation of law went unpunished, while even the law itself had become uncertain."

Foreign military relations
During the 17th and 18th centuries, the Cambodian empire had been in decline and Vietnamese people migrated south into the Mekong Delta, which had previously been Khmer territory. Furthermore, Cambodia had been periodically invaded by both Vietnam and Siam. Cambodia lurched uneasily between both poles of domination as dictated by the internal strife of her two larger neighbors. In 1796, Ang Eng, a pro-Siamese king, had died, leaving Ang Chan, who was born in 1791. When Gia Long unified Vietnam, Eng was given investiture by Siam in order to hold out Vietnamese influence, but in 1803, a Cambodian mission paid tribute to Vietnam in attempt to placate Gia Long, something that became an annual routine. In 1807, Ang Chan requested formal investiture as a vassal of Gia Long. Gia Long responded by sending an ambassador bearing the book of investiture, together with a seal of gilded silver. In 1812, Ang Chan refused a request from his brother Ang Snguon to share power, leading to a rebellion. Siam sent troops to support the rebel prince, hoping to enthrone him and wrest influence from Gia Long over Cambodia. In 1813, Gia Long responded by sending a large military contingent that forced the Siamese and Ang Snguon out of Cambodia. As a result, a Vietnamese garrison was permanently installed in the citadel at Phnom Penh, the Cambodian capital. Thereafter, Siam made no attempts to regain control of Cambodia during Gia Long's rule.

Napoleon's aims to conquer Vietnam as a base to threaten Company rule in India never materialized, having been preoccupied by vast military ambitions on mainland Europe. However, France remained the only European power with permanent spokesmen in Vietnam during his reign.

Trade relations
Pigneau's aborted deal with France allowed Gia Long to keep his country closed to western trade. Gia Long was generally dismissive of European commercial overtures. This was part of a policy of trying to maintain friendly relations with every European power by granting favors to none. In 1804, a British delegation attempted to negotiate trading privileges with Vietnam. It was the only offer of its kind until 1822, such was the extent of European disinterest in Asia during the Napoleonic Wars. Gia Long had purchased arms from British firms in Madras and Calcutta on credit, prompting the British East India Company to send John Roberts to Huế. However, Roberts's gifts were turned away and the negotiations for a commercial deal never started. The British then made a request for the exclusive right to trade with Vietnam and the cession of the island of Cham near Faifo, which was rejected, as were further approaches from the Netherlands. Both of these failed attempts were attributed to the influence of the French mandarins. In 1817, the French Prime Minister Armand-Emmanuel du Plessis dispatched the Cybele, a frigate with 52 guns to Tourane (now Da Nang) to "show French sympathy and to assure Gia Long of the benevolence of the King of France". The captain of the vessel was turned away, ostensibly on grounds of protocol for not carrying a royal letter from the French king.

Gia Long kept four French officers in his service after his coronation: Philippe Vannier, Jean-Baptiste Chaigneau, de Forsans and the doctor Despiau. All became high ranking mandarins and were treated well. They were given 50 bodyguards each, ornate residences and were exempt for having to prostrate before the emperor. Recommendations from French officials in Pondicherry to Napoleon Bonaparte suggesting the re-establishment of diplomatic relations with Vietnam were fruitless due to the preoccupation with war in Europe. However, French merchants from Bordeaux were later able to begin trading with Vietnam after the further efforts of the Duc de Richelieu.

Domestic policies and capital works
Gia Long abolished all large landholding by princes, nobles, and high officials. He dismantled the 800-year-old practice of paying officials and rewarding or endowing nobles with a portion of the taxes from a village or a group thereof. Existing highways were repaired, and new ones constructed, with the north–south road from Saigon to Lạng Sơn put under restoration. He organized a postal service to operate along the highways and public storehouses were built to alleviate starvation in drought-affected years. Gia Long enacted monetary reform and implemented a more socialized agrarian policy. However, the population growth far outstripped that of land clearing and cultivation. There was little emphasis on innovation in agricultural technology, so the improvements in productivity were mainly derived from increasing the amount of cultivated farmland.

Although the civil war was over, Gia Long decided to add to the two citadels that had been built under the supervision of French officers. Gia Long was convinced of their effectiveness and during his 18-year reign, a further 11 citadels were built throughout the country. The majority were built in the Vauban style, with pentagonal or hexagonal geometry, while a minority, including the one in Huế, were built in a four-sided traditional Chinese design. The fortresses were built at Vinh, Thanh Hóa, Bắc Ninh, Hà Tĩnh, Thái Nguyên and Hải Dương in the north, Huế, Quảng Ngãi, Khánh Hòa and Bình Định in the centre, and Vĩnh Long in the Mekong Delta. Construction was at its most intense in the early phase of Gia Long's reign, only one of the 11 was built in the last six years of his rule. De Puymanel and Lebrun left Vietnam before the end of the war, so the forts were designed by Vietnamese engineers who oversaw the construction. The position of Citadel Supervision Officer was created under the Ministry of War and made responsible for the work, underlining the importance that Gia Long placed on fortifications. Gia Long's fortifications program was marred by accusations that the people labored all day and part of the night in all weather conditions, and that as a direct consequence, land went fallow. Complaints of mandarin corruption and oppressive taxation were often leveled at his government. Following his coronation, Gia Long drastically reduced his naval fleet, and by the 1810s, only two of the European-style vessels were still in service. The downsizing of the navy was mainly attributed to budgetary constraints caused by heavy spending on fortifications and transport infrastructures such as roads, dykes, and canals. However, in 1819, a new phase of shipbuilding was launched, with Gia Long personally supervising the dockyards.

Social policy
In order to train and recruit government officials, Gia Long revived the Confucian court examinations that had been abolished by the Tây Sơn. In 1803, he founded the National Academy (Quốc Tử Giám) at Huế. Its objective was to educate the sons of mandarins and meritorious students in Confucian classical literature. In 1804, Gia Long promulgated edicts establishing similar schools in the provinces, as well as guidelines to regulate their staff and curriculum. He appointed Directors of Education (quan đốc học) to oversee the provincial education system and the selection process for the entrance examinations to the National Academy, beginning in 1802. The Directors were assisted by Subordinate and Assistant Directors (phó đốc học or trợ-giáo). Gia Long explained to his court in 1814 that the goal was to create a cadre of classically educated, politically loyal administrators:

"The schools are where men of talent can be found. Wanting to follow the example of the former kings, I have established schools in order that learned and talented men will arise and the state may thus employ them."

In 1807, Gia Long opened the first civil service examinations held under the Nguyễn dynasty, staged at regional level. From then on, the training and selection process for the imperial bureaucracy was largely centered on examinations. The curriculum for the examinations consisted of the Four Books and Five Classics, which focused on Chinese history leading up to the Song dynasty, while regarding other knowledge as irrelevant.

Gia Long promulgated a new legal code to replace the system that had existed since the Hong Duc era of Lê Thánh Tông in the 15th century. Work started in 1811 under a group of scholars led by Nguyễn Văn Thành, and in 1815, the Bộ luật Gia Long (Gia Long Code) was issued. Although Gia Long claimed that his new system was a mixture of the Le code and Qing dynasty system of China, most scholars regard it as being a near-complete copy of the Qing code. The code was later translated into French by Paul-Louis-Félix Philastre. It focused on strengthening the power and authority of the emperor, his mandarins, and the traditional family unit. In cases of serious crimes, particularly those against the state, collective punishment was meted out to the family of the convict, including the death penalty.

Now that Vietnam was unified, the center of gravity of the country moved further south, following centuries of southerly migration and conquest, so Gia Long moved the seat of government from Hanoi to Huế. Gia Long rebuilt the old citadel of Phú Xuân into a fortress stronghold. The structure was a square shape of 2.5 km per side. A 9 m rampart was encased with masonry and protected by protruding bastions, each defended by 36 guns. The exterior and interior were flanked and reinforced by a series of moats. The citadel's defenders included an 800-strong elephant troop. The new palace structure, protocol and court dress were all taken directly from Qing dynasty styles, and his palace and fortress was intended to be a smaller copy of the Chinese Forbidden City in the 1800s.

Gia Long tolerated the Catholic faith of his French allies and permitted unimpeded missionary activities out of respect to his benefactors. The missionary activity was dominated by the Spanish in Tonkin and French in the central and southern regions. At the time of his death, there were six European bishops in Vietnam. The population of Christians was estimated at 300,000 in Tonkin and 60,000 in Cochinchina. However, he expressed dismay at the Catholic condemnation of the traditional ancestor worship, a basic tenet of Vietnamese culture. Gia Long was also known for his disdain for Buddhism, the religion practiced by the majority of the population. Despite its popularity among ladies of the court, Gia Long often restricted the activities of Buddhists.

In August 1802, Gia Long retaliated against the captured Tây Sơn leadership who had executed his family in the 1770s. The surviving members of the family and its leading generals and their families were executed. The remains of Quang Trung and his queen were exhumed and desecrated, and his son, the last Tây Sơn monarch Quang Toản was bound to four elephants and torn apart. Gia Long repealed the changes enacted by Quang Trung and reverted to the prior Confucian orthodoxy. This included restoring the civil service to the forefront of decision making, ahead of the army, and reversed Quang Trung's education reforms, which put science before the study of Confucian literature.

Family and succession
Gia Long had many wives, but the most famous consorts are Empress Thừa Thiên, Empress Thuận Thiên, and Consort Lê Ngọc Bình. In 1780, during the war against the Tây Sơn, he married Tống Thị Lan, the daughter of a Nguyen general. They had two sons, the first being Nguyễn Phúc Chiêu, who died shortly after birth in Phú Quốc island, and later Crown Prince Nguyễn Phúc Cảnh. Following Gia Long's ascension to the throne, she became Empress consort and was given the title of Empress Thừa Thiên posthumously. Around 1781, during the war with the Tây Sơn, he married his second wife Trần Thị Đang, a daughter of one of his ministers. They had three sons, Nguyễn Phúc Đảm, Nguyen Phuc Dai and Nguyen Phuc Chan, and was posthumously given the title of Empress Thuận Thiên. After his conquest of Vietnam, Gia Long, took his third wife, Lê Ngọc Bình. A daughter of Lê Hiển Tông, the penultimate emperor of the Lê dynasty, she was betrothed by Emperor Quang Trung to his son Quang Toản. After Gia Long defeated the Tây Sơn and executed Quang Toan, he took her as his wife. Gia Long had almost 100 concubines who were daughters of his mandarins; Gia Long did not favor polygamy but he did so to secure the loyalty of his inner circle.

As Crown Prince Nguyen Canh had died of smallpox during the war against the Tây Sơn, it was assumed that Canh's son would succeed Gia Long as emperor, but in 1816 Nguyễn Phúc Đảm, the son of his second wife, was appointed instead, and ruled as Minh Mạng. Gia Long chose him for his strong character and his deep aversion to westerners, whereas Canh's lineage had converted to Catholicism and were reluctant to maintain their Confucian traditions such as ancestor worship. Before his accession, Nguyễn Phúc Đảm was reported to have praised the Japanese for having expelled and eradicated Christianity from their country. Gia Long told his son to treat the Europeans respectfully, especially the French, but not to grant them any position of preponderance. Gia Long died on 3 February 1820 and was buried at the Thien Tho Tomb and posthumously named Thế Tổ Cao Hoàng đế.