The basic nature of Vietnamese society changed little during the nearly 1,000 years between independence from China in the 10th century and the French conquest in the 19th century. The king was the ultimate source of political authority, the final dispenser of justice, law, and supreme commander-in-chief of the armed forces, as well as overseer of religious rituals. Administration was carried out by mandarins who were trained exactly like their Chinese counterparts (i.e. by rigorous study of Confucian texts). Overall, Vietnam remained very efficiently and stably governed except in times of war and dynastic breakdown, and its administrative system was probably far more advanced than that of any other Southeast Asian state. No serious challenge to the king's authority ever arose, as titles of nobility were bestowed purely as honors and were not hereditary. Periodic land reforms broke up large estates and ensured that powerful landowners could not emerge. No religious/priestly class ever arose outside of the mandarins either. This stagnant absolutism ensured a stable, well-ordered society, but also resistance to social, cultural, or technological innovations. Reformers looked only to the past for inspiration.
Literacy remained the provenance of the upper classes. Initially, Chinese was used for writing purposes, but by the 13th century, a set of derivative characters known as Chữ Nôm emerged that allowed native Vietnamese words to be written. However, it remained limited to poetry, literature, and practical texts like medicine while all state and official documents were written in Classical Chinese. Aside from some mining and fishing, agriculture was the primary activity of most Vietnamese, and economic development and trade were not promoted or encouraged by the state.
Ngô, Đinh, & Early Lê dynasties (939–1009)
Ngô Quyền's untimely death after a short reign resulted in a power struggle for the throne, the country's first major civil war, the upheaval of Twelfth Warlords (Loạn Thập Nhị Sứ Quân). The war lasted from 944 to 968 when the clan led by Đinh Bộ Lĩnh defeated the other warlords, unifying the country. Bộ Lĩnh founded the Đinh dynasty and proclaimed himself Đinh Tiên Hoàng (Đinh the First Emperor) and renamed the country from Tĩnh Hải quân to Đại Cồ Việt (literally "Great Viet Land"), with its capital in Hoa Lư (modern-day Ninh Bình Province). Emperor Đinh Tiên Hoàng introduced strict penal codes to prevent chaos from happening again. He tried to form alliances by granting the title of Queen to five women from the five most influential families.
In 979, Emperor Đinh Tiên Hoàng and his crown prince Đinh Liễn were assassinated, leaving his lone surviving son, the 6-year-old Đinh Toàn, to assume the throne. Taking advantage of the situation, Song China invaded Đại Cồ Việt. Facing such a grave threat to national independence, the court's Commander of the Ten Armies (Thập Đạo Tướng Quân) Lê Hoàn took the throne, founding the Early Lê dynasty. A capable military tactician, Lê Hoan realized the risks of engaging the mighty Song troops head on; thus he tricked the invading army into Chi Lăng Pass, then ambushed and killed their commander, quickly ending the threat to his young nation in 981. The Song dynasty withdrew their troops and Lê Hoàn referred to in his realm as Đại Hành Emperor (Đại Hành Hoàng Đế). Emperor Lê Đại Hành was also the first Vietnamese monarch who began the southward expansion process against the kingdom of Champa.
Emperor Lê Đại Hành's death in 1005 resulted in infighting for the throne amongst his sons. The eventual winner, Lê Long Đĩnh, became the most notorious tyrant in Vietnamese history. He devised sadistic punishments of prisoners for his own entertainment and indulged in deviant sexual activities. Toward the end of his short life – he died at 24 – Lê Long Đĩnh became so ill that he had to lie down when meeting with his officials in court.
Lý, Trần, & Hồ dynasties (1009–1407)
Southeast Asia c. 1010 AD. Đại Việt lands in yellow, Champa in green and Khmer Empire in purple
When the king Lê Long Đĩnh died in 1009, a Palace Guard Commander named Lý Công Uẩn was nominated by the court to take over the throne, and founded the Lý dynasty. This event is regarded as the beginning of another golden era in Vietnamese history, with great following dynasties. The way Lý Công Uẩn ascended to the throne was rather uncommon in Vietnamese history. As a high-ranking military commander residing in the capital, he had all opportunities to seize power during the tumultuous years after Emperor Lê Hoàn's death, yet preferring not to do so out of his sense of duty. He was in a way being "elected" by the court after some debate before a consensus was reached.
The Lý dynasty is credited for laying down a concrete foundation, with strategic vision, for the nation of Vietnam. Leaving Hoa Lư, a natural fortification surrounded by mountains and rivers, Lý Công Uẩn moved his court to the new capital in present-day Hanoi and called it Thăng Long (Ascending Dragon).Lý Công Uẩn thus departed from the militarily defensive mentality of his predecessors and envisioned a strong economy as the key to national survival. The third emperor of the dynasty, Lý Thánh Tông renamed the country "Đại Việt" (大越, Great Viet). Successive Lý emperors continued to accomplish far-reaching feats: building a dike system to protect the rice producing area; founding Quốc Tử Giám, the first noble university; holding regular examinations to select capable commoners for government positions once every three years; organizing a new system of taxation; establishing humane treatment of prisoners. Women were holding important roles in Lý society as the court ladies were in charge of tax collection. The Lý dynasty also promoted Buddhism, yet maintained a pluralistic attitude toward the three main philosophical systems of the time: Buddhism, Confucianism, and Taoism.
The Lý dynasty had two major wars with Song China, and a few conquests against neighboring Champa in the south. The most notable battle took place on Chinese territory in 1075. Upon learning that a Song invasion was imminent, the Lý army and navy totaling about 100,000 men under the command of Lý Thường Kiệt, Tông Đản used amphibious operations to preemptively destroy three Song military installations at Yong Zhou, Qin Zhou, and Lian Zhou in present-day Guangdong and Guangxi, and killed 100,000 Chinese. The Song dynasty took revenge and invaded Đại Việt in 1076, but the Song troops were held back at the Battle of Như Nguyệt River commonly known as the Cầu river, now in Bắc Ninh province about 40 km from the current capital, Hanoi. Neither side was able to force a victory, so the Lý dynasty proposed a truce, which the Song emperor accepted. Champa and the powerful Khmer Empire took advantage of the Lý dynasty's distraction with the Song to pillage the south of the country. Together they invaded Vietnam in 1128 and 1132. Further invasions followed in the subsequent decades.
Trần royal battle standard
Toward the end of the Lý dynasty, a powerful court minister named Trần Thủ Độ forced king Lý Huệ Tông to become a Buddhist monk and Lý Chiêu Hoàng, Huệ Tông's young daughter, to become queen. Trần Thủ Độ then arranged the marriage of Chiêu Hoàng to his nephew Trần Cảnh and eventually had the throne transferred to Trần Cảnh, thus begun the Trần dynasty.
Trần Thủ Độ viciously purged members of the Lý nobility; some Lý princes escaped to Korea, including Lý Long Tường. After the purge, most Trần emperors ruled the country in similar manner to the Lý kings. Noted Trần dynasty accomplishments include the creation of a system of population records based at the village level, the compilation of a formal 30-volume history of Đại Việt (Đại Việt Sử Ký) by Lê Văn Hưu, and the rising in status of the Nôm script, a system of writing for Vietnamese language. The Trần dynasty also adopted a unique way to train new emperors: when a crown prince reached the age of 18, his predecessor would abdicate and turn the throne over to him, yet holding a title of August Higher Emperor (Thái Thượng Hoàng), acting as a mentor to the new Emperor. Despite continued Champa-Khmer attacks, the Trần managed to arrange several periods of peace with them.
During the Trần dynasty, the armies of the Mongol Empire under Möngke Khan and Kublai Khan invaded Vietnam in 1258, 1285, and 1287 88. Đại Việt repelled all attacks of the Yuan Mongols during the reign of Kublai Khan. Three Mongol armies said to have numbered from 300,000 to 500,000 men were defeated. The key to Đại Việt's successes was to avoid the Mongols' strength in open field battles and city sieges—the Trần court abandoned the capital and the cities. The Mongols were then countered decisively at their weak points, which were battles in swampy areas such as Chương Dương, Hàm Tử, Vạn Kiếp and on rivers such as Vân Đồn and Bạch Đằng. The Mongols also suffered from tropical diseases and loss of supplies to Trần army's raids. The Yuan-Trần war reached its climax when the retreating Yuan fleet was decimated at the Battle of Bạch Đằng (1288). The military architect behind Đại Việt's victories was Commander Trần Quốc Tuấn, more popularly known as Trần Hưng Đạo. In order to avoid further disastrous campaigns, the Tran and Champa acknowledged Mongol supremacy.
It was also during this period that the Trần emperors waged many wars against the southern kingdom of Champa, continuing the Viets' long history of southern expansion (known as Nam tiến) that had begun shortly after gaining independence in the 10th century. Often, they encountered strong resistance from the Chams. Champa was made into a tributary state of Vietnam in 1312, but ten years later regained independence and Cham troops led by king Chế Bồng Nga (Cham: Po Binasuor or Che Bonguar) killed king Trần Duệ Tông in battle and even laid siege to Đại Việt's capital Thăng Long in 1377 and again in 1383. However, the Trần dynasty was successful in gaining two Champa provinces, located around present-day Huế, through the peaceful means of the political marriage of Princess Huyền Trân to a Cham king.
The wars with Champa and the Mongols left Vietnam exhausted and bankrupt. The Trần dynasty was in turn overthrown by one of its own court officials, Hồ Quý Ly. Hồ Quý Ly forced the last Trần emperor to resign and assumed the throne in 1400. He changed the country name to Đại Ngu and moved the capital to Tây Đô, Western Capital, now Thanh Hóa. Thăng Long was renamed Đông Đô, Eastern Capital. Although widely blamed for causing national disunity and losing the country later to the Ming Empire, Hồ Quý Ly's reign actually introduced a lot of progressive, ambitious reforms, including the addition of mathematics to the national examinations, the open critique of Confucian philosophy, the use of paper currency in place of coins, investment in building large warships and cannon, and land reform. He ceded the throne to his son, Hồ Hán Thương, in 1401 and assumed the title Thái Thượng Hoàng, in similar manner to the Trần kings.
Ming domination & Later Lê dynasty (1407–1527)
In 1407, under the pretext of helping to restore the Trần dynasty, Chinese Ming troops invaded Đại Ngu and captured Hồ Quý Ly and Hồ Hán Thương. The Hồ dynasty came to an end after only 7 years in power. The Ming occupying force annexed Đại Ngu into the Ming Empire after claiming that there was no heir to Trần throne. Vietnam, weakened by dynastic feuds and the wars with Champa, quickly succumbed. The Ming conquest was harsh. Vietnam was annexed directly as a province of China, the old policy of cultural assimilation again imposed forcibly, and the country was ruthlessly exploited. However, by this time, Vietnamese nationalism had reached a point where attempts to turn them into Chinese could only strengthen further resistance. Almost immediately, Trần loyalists started a resistance war. The resistance, under the leadership of Trần Quĩ at first gained some advances, yet as Trần Quĩ executed two top commanders out of suspicion, a rift widened within his ranks and resulted in his defeat in 1413.
In 1418, a wealthy farmer, Lê Lợi, led the Lam Sơn uprising against the Ming from his base of Lam Sơn (Thanh Hóa province). Overcoming many early setbacks and with strategic advices from Nguyễn Trãi, Lê Lợi's movement finally gathered momentum, marched northward, and launched a siege at Đông Quan (now Hanoi), the capital of the Ming occupation. The Ming Emperor sent a reinforcement force, but Lê Lợi staged an ambush and killed the Ming commander, Liu Shan (Vietnamese: Liễu Thăng), in Chi Lăng. Ming troops at Đông Quan surrendered. The Lam Sơn revolution killed 300,000 Ming soldiers. In 1428, Lê Lợi ascended to the throne and began the Hậu Lê dynasty (Posterior or Later Lê). Lê Lợi renamed the country back to Đại Việt and moved the capital back to Thăng Long.
The Lê dynasty carried out land reforms to revitalize the economy after the war. Unlike the Lý and Trần kings, who were more influenced by Buddhism, the Lê kings leaned toward Confucianism. A comprehensive set of laws, the Hồng Đức code was introduced with some strong Confucian elements, yet also included some progressive rules, such as the rights of women. Art and architecture during the Lê dynasty also became more influenced by Chinese styles than during the Lý and Trần dynasty. The Lê dynasty commissioned the drawing of national maps and had Ngô Sĩ Liên continue the task of writing Đại Việt's history up to the time of Lê Lợi. King Lê Thánh Tông opened hospitals and had officials distribute medicines to areas affected with epidemics.
Overpopulation and land shortages stimulated Vietnamese expansion south. In 1471, Le troops led by king Lê Thánh Tông invaded Champa and captured its capital Vijaya. This event effectively ended Champa as a powerful kingdom, although some smaller surviving Cham states lasted for a few centuries more. It initiated the dispersal of the Cham people across Southeast Asia. With the kingdom of Champa mostly destroyed and the Cham people exiled or suppressed, Vietnamese colonization of what is now central Vietnam proceeded without substantial resistance. However, despite becoming greatly outnumbered by Kinh (Việt) settlers and the integration of formerly Cham territory into the Vietnamese nation, the majority of Cham people nevertheless remained in Vietnam and they are now considered one of the key minorities in modern Vietnam. Vietnamese armies also raided the Mekong Delta, which the decaying Khmer Empire could no longer defend. The city of Huế, founded in 1600 lies close to where the Champa capital of Indrapura once stood. In 1479, King Lê Thánh Tông also campaigned against Laos and captured its capital Luang Prabang. He made further incursions westwards into the Irrawaddy River region in modern-day Burma before withdrawing.
Mạc & Restored Lê dynasties (1527–1788)
Main articles: Lê dynasty, Mạc dynasty and Southern and Northern Dynasties of Vietnam
The Lê dynasty was overthrown by its general named Mạc Đăng Dung in 1527. He killed the Lê emperor and proclaimed himself emperor, starting the Mạc dynasty. After defeating many revolutions for two years, Mạc Đăng Dung adopted the Trần dynasty's practice and ceded the throne to his son, Mạc Đăng Doanh, and he became Thái Thượng Hoàng.
Meanwhile, Nguyễn Kim, a former official in the Lê court, revolted against the Mạc and helped king Lê Trang Tông restore the Lê court in the Thanh Hóa area. Thus a civil war began between the Northern Court (Mạc) and the Southern Court (Restored Lê). Nguyễn Kim's side controlled the southern part of Đại Việt (from Thanhhoa to the south), leaving the north (including Đông Kinh-Hanoi) under Mạc control. When Nguyễn Kim was assassinated in 1545, military power fell into the hands of his son-in-law, Trịnh Kiểm. In 1558, Nguyễn Kim's son, Nguyễn Hoàng, suspecting that Trịnh Kiểm might kill him as he had done to his brother to secure power, asked to be governor of the far south provinces around present-day Quảng Bình to Bình Định. Hoang pretended to be insane, so Kiem was fooled into thinking that sending Hoang south was a good move as Hoang would be quickly killed in the lawless border regions. However, Hoang governed the south effectively while Trịnh Kiểm, and then his son Trịnh Tùng, carried on the war against the Mạc. Nguyễn Hoàng sent money and soldiers north to help the war but gradually he became more and more independent, transforming their realm's economic fortunes by turning it into an international trading post.
The civil war between the Lê/Trịnh and Mạc dynasties ended in 1592, when the army of Trịnh Tùng conquered Hanoi and executed king Mạc Mậu Hợp. Survivors of the Mạc royal family fled to the northern mountains in the province of Cao Bằng and continued to rule there until 1677 when Trịnh Tạc conquered this last Mạc territory. The Lê kings, ever since Nguyễn Kim's restoration, only acted as figureheads. After the fall of the Mạc dynasty, all real power in the north belonged to the Trịnh lords. Meanwhile, the Ming court reluctantly decided on a military intervention into the Vietnamese civil war, but Mạc Đăng Dung offered ritual submission to the Ming Empire, which was accepted.
Map of Vietnam showing (roughly) the areas controlled by the Trịnh, Nguyễn, Mạc, and Champa around 1650. Violet: Trịnh Territory. Yellow: Nguyễn Territory. Green: Champa-Panduranga (under Nguyễn overlordship). Pink (Cao Bang): Mạc Territory. Orange: Vũ Lordship
Trịnh & Nguyễn lords
In the year 1600, Nguyễn Hoàng also declared himself Lord (officially "Vương", popularly "Chúa") and refused to send more money or soldiers to help the Trịnh. He also moved his capital to Phú Xuân, modern-day Huế. Nguyễn Hoàng died in 1613 after having ruled the south for 55 years. He was succeeded by his 6th son, Nguyễn Phúc Nguyên, who likewise refused to acknowledge the power of the Trịnh, yet still pledged allegiance to the Lê king.
Trịnh Tráng succeeded Trịnh Tùng, his father, upon his death in 1623. Tráng ordered Nguyễn Phúc Nguyên to submit to his authority. The order was refused twice. In 1627, Trịnh Tráng sent 150,000 troops southward in an unsuccessful military campaign. The Trịnh were much stronger, with a larger population, economy and army, but they were unable to vanquish the Nguyễn, who had built two defensive stone walls and invested in Portuguese artillery.
The Trịnh–Nguyễn War lasted from 1627 until 1672. The Trịnh army staged at least seven offensives, all of which failed to capture Phú Xuân. For a time, starting in 1651, the Nguyễn themselves went on the offensive and attacked parts of Trịnh territory. However, the Trịnh, under a new leader, Trịnh Tạc, forced the Nguyễn back by 1655. After one last offensive in 1672, Trịnh Tạc agreed to a truce with the Nguyễn Lord Nguyễn Phúc Tần. The country was effectively divided in two.
Advent of Europeans & southward expansion
One of the earliest Western maps of Vietnam, published in 1651 by Alexandre de Rhodes (north is oriented to the right).
The West's exposure in Vietnam and Vietnam's exposure to Westerners dated back to 166 AD with the arrival of merchants from the Roman Empire, to 1292 with the visit of Marco Polo, and the early 16th century with the arrival of Portuguese in 1516 and other European traders and missionaries. Alexandre de Rhodes, a French Jesuit priest, improved on earlier work by Portuguese missionaries and developed the Vietnamese romanized alphabet Quốc Ngữ in Dictionarium Annamiticum Lusitanum et Latinum in 1651. Various European efforts to establish trading posts in Vietnam failed, but missionaries were allowed to operate for some time until the mandarins began concluding that Christianity (which had succeeded in converting up to a tenth of the population by 1700) was a threat to the Confucian social order since it condemned ancestor worship as idolatry. Vietnamese attitudes to Europeans and Christianity hardened as they began to increasingly see it as a way of undermining society.
Between 1627 and 1775, two powerful families had partitioned the country: the Nguyễn lords ruled the South and the Trịnh lords ruled the North. The Trịnh–Nguyễn War gave European traders the opportunities to support each side with weapons and technology: the Portuguese assisted the Nguyễn in the South while the Dutch helped the Trịnh in the North. The Trịnh and the Nguyễn maintained a relative peace for the next hundred years, during which both sides made significant accomplishments. The Trịnh created centralized government offices in charge of state budget and producing currency, unified the weight units into a decimal system, established printing shops to reduce the need to import printed materials from China, opened a military academy, and compiled history books.
Meanwhile, the Nguyễn lords continued the southward expansion by the conquest of the remaining Cham land. Việt settlers also arrived in the sparsely populated area known as "Water Chenla", which was the lower Mekong Delta portion of the former Khmer Empire. Between the mid-17th century to mid-18th century, as the former Khmer Empire was weakened by internal strife and Siamese invasions, the Nguyễn Lords used various means, political marriage, diplomatic pressure, political and military favors, to gain the area around present-day Saigon and the Mekong Delta. The Nguyễn army at times also clashed with the Siamese army to establish influence over the former Khmer Empire.
Tây Sơn & Nguyễn dynasties (1778–1945)
In 1771, the Tây Sơn revolution broke out in Quy Nhơn, which was under the control of the Nguyễn lord. The leaders of this revolution were three brothers named Nguyễn Nhạc, Nguyễn Lữ, and Nguyễn Huệ, not related to the Nguyễn lords. By 1776, the Tây Sơn had occupied all of the Nguyễn Lord's land and killed almost the entire royal family. The surviving prince Nguyễn Phúc Ánh (often called Nguyễn Ánh) fled to Siam, and obtained military support from the Siamese king. Nguyễn Ánh came back with 50,000 Siamese troops to regain power, but was defeated at the Battle of Rạch Gầm–Xoài Mút and almost killed. Nguyễn Ánh fled Vietnam, but he did not give up.
The Tây Sơn army commanded by Nguyễn Huệ marched north in 1786 to fight the Trịnh Lord, Trịnh Khải. The Trịnh army failed and Trịnh Khải committed suicide. The Tây Sơn army captured the capital in less than two months. The last Lê emperor, Lê Chiêu Thống, fled to Qing China and petitioned the Qianlong Emperor for help. The Qianlong Emperor supplied Lê Chiêu Thống with a massive army of around 200,000 troops to regain his throne from the usurper. Nguyễn Huệ proclaimed himself Emperor Quang Trung and defeated the Qing troops with 100,000 men in a surprise 7 day campaign during the lunar new year (Tết). During his reign, Quang Trung envisioned many reforms but died by unknown reason on the way march south in 1792, at the age of 40. During the reign of Emperor Quang Trung, Đại Việt was in fact divided into three political entities. The Tây Sơn leader, Nguyễn Nhạc, ruled the centre of the country from his capital Qui Nhơn. Emperor Quang Trung ruled the north from the capital Phú Xuân Huế. In the South, Nguyễn Ánh, assisted by many talented recruits from the South, captured Gia Định (present-day Saigon) in 1788 and established a strong base for his force.
After Quang Trung's death, the Tây Sơn dynasty became unstable as the remaining brothers fought against each other and against the people who were loyal to Nguyễn Huệ's infant son. Nguyễn Ánh sailed north in 1799, capturing Tây Sơn's stronghold Qui Nhơn. In 1801, his force took Phú Xuân, the Tây Sơn capital. Nguyễn Ánh finally won the war in 1802, when he sieged Thăng Long (Hanoi) and executed Nguyễn Huệ's son, Nguyễn Quang Toản, along with many Tây Sơn generals and officials. Nguyễn Ánh ascended the throne and called himself Emperor Gia Long. Gia is for Gia Định, the old name of Saigon; Long is for Thăng Long, the old name of Hanoi. Hence Gia Long implied the unification of the country. The Nguyễn dynasty lasted until Bảo Đại's abdication in 1945. As China for centuries had referred to Đại Việt as Annam, Gia Long asked the Manchu Qing emperor to rename the country, from Annam to Nam Việt. To prevent any confusion of Gia Long's kingdom with Triệu Đà's ancient kingdom, the Manchu emperor reversed the order of the two words to Việt Nam. The name Vietnam is thus known to be used since Emperor Gia Long's reign. Recently historians have found that this name had existed in older books in which Vietnamese referred to their country as Vietnam.
The Period of Division with its many tragedies and dramatic historical developments inspired many poets and gave rise to some Vietnamese masterpieces in verse, including the epic poem The Tale of Kiều (Truyện Kiều) by Nguyễn Du, Song of a Soldier's Wife (Chinh Phụ Ngâm) by Đặng Trần Côn and Đoàn Thị Điểm, and a collection of satirical, erotically charged poems by a female poet, Hồ Xuân Hương.
Many Catholic martyrs (believers and priests) were slain in Tonkin, Cochinchina and Annam during persecutions. 64 Martyrs were declared blessed in 1900 of whom 54 were natives; 26 of the martyrs were members of the Dominican Order.
In 1784, during the conflict between Nguyễn Ánh, the surviving heir of the Nguyễn lords, and the Tây Sơn dynasty, a French Roman Catholic prelate, Pigneaux de Behaine, sailed to France to seek military backing for Nguyễn Ánh. At Louis XVI's court, Pigneaux brokered the Little Treaty of Versailles which promised French military aid in exchange for Vietnamese concessions. However, because of the French Revolution, Pigneaux's plan failed to materialize. He went to the French territory of Pondichéry (India), and secured two ships, a regiment of Indian troops, and a handful of volunteers and returned to Vietnam in 1788. One of Pigneaux's volunteers, Jean-Marie Dayot, reorganized Nguyễn Ánh's navy along European lines and defeated the Tây Sơn at Qui Nhơn in 1792. A few years later, Nguyễn Ánh's forces captured Saigon, where Pigneaux died in 1799. Another volunteer, Victor Olivier de Puymanel would later build the Gia Định fort in central Saigon.
After Nguyễn Ánh established the Nguyễn dynasty in 1802, he tolerated Catholicism and employed some Europeans in his court as advisors. His successors were more conservative Confucians and resisted Westernization. The next Nguyễn emperors, Minh Mạng, Thiệu Trị, and Tự Đức brutally suppressed Catholicism and pursued a 'closed door' policy, perceiving the Westerners as a threat, following events such as the Lê Văn Khôi revolt when a French missionary, Fr. Joseph Marchand, encouraged local Catholics to revolt in an attempt to install a Catholic emperor. Catholics, both Vietnamese and foreign-born, were persecuted in retaliation. Trade with the West slowed during this period. There were frequent uprisings against the Nguyễns, with hundreds of such events being recorded in the annals. These acts were soon being used as excuses for France to invade Vietnam. The early Nguyễn dynasty had engaged in many of the constructive activities of its predecessors, building roads, digging canals, issuing a legal code, holding examinations, sponsoring care facilities for the sick, compiling maps and history books, and exerting influence over Cambodia and Laos.
Under the orders of Napoleon III of France, Rigault de Genouilly's gunships attacked the port of Đà Nẵng in 1858, causing significant damage, yet failed to gain any foothold, in the process being afflicted by the humidity and tropical diseases. De Genouilly decided to sail south and captured the poorly defended city of Gia Định (present-day Ho Chi Minh City). From 1859–67, French troops expanded their control over all six provinces on the Mekong delta and formed a colony known as Cochinchina.
French army attacking Nam Định, 1883.
A few years later, French troops landed in northern Vietnam (which they called Tonkin) and captured Hà Nội twice in 1873 and 1882. The French managed to keep their grip on Tonkin although, twice, their top commanders Francis Garnier and Henri Rivière, were ambushed and killed fighting pirates of the Black Flag Army hired by the mandarins. France assumed control over the whole of Vietnam after the Tonkin Campaign (1883–1886). French Indochina was formed in October 1887 from Annam (Trung Kỳ, central Vietnam), Tonkin (Bắc Kỳ, northern Vietnam), Cochinchina (Nam Kỳ, southern Vietnam, and Cambodia, with Laos added in 1893). Within French Indochina, Cochinchina had the status of a colony, Annam was nominally a protectorate where the Nguyễn dynasty still ruled, and Tonkin had a French governor with local governments run by Vietnamese officials.
After Gia Định fell to French troops, many resistance movements broke out in occupied areas, some led by former court officers, such as Trương Định, some by peasants, such as Nguyễn Trung Trực, who sank the French gunship L'Esperance using guerilla tactics. In the north, most movements were led by former court officers and lasted decades, with Phan Đình Phùng fighting in central Vietnam until 1895. In the northern mountains, former bandit leader Hoàng Hoa Thám fought until 1911. Even the teenage Nguyễn Emperor Hàm Nghi left the Imperial Palace of Huế in 1885 with regent Tôn Thất Thuyết and started the Cần Vương ("Save the King") movement, trying to rally the people to resist the French. He was captured in 1888 and exiled to French Algeria. Guerrillas of the Cần Vương movement murdered around a third of Vietnam's Christian population during the rebellion. Decades later, two more Nguyễn kings, Thành Thái and Duy Tân were also exiled to Africa for having anti-French tendencies. The former was deposed on the pretext of insanity and Duy Tân was caught in a conspiracy with the mandarin Trần Cao Vân trying to start an uprising. However, lack of modern weapons and equipment prevented these resistance movements from being able to engage the French in open combat. The various anti-French revolts started by mandarins were carried out with the primary goal of restoring the old feudal society. However, by 1900 a new generation of Vietnamese were coming of age who had never lived in precolonial Vietnam. These young activists were as eager as their grandparents to see independence restored, but they realized that returning to the feudal order was not feasible and that modern technology and governmental systems were needed. Having been exposed to Western philosophy, they aimed to establish a republic upon independence, departing from the royalist sentiments of the Cần Vương movements. Some of them set up Vietnamese independence societies in Japan, which many viewed as a model society (i.e. an Asian nation that had modernized, but retained its own culture and institutions).
There emerged two parallel movements of modernization. The first was the Đông Du ("Go East") Movement started in 1905 by Phan Bội Châu. Châu's plan was to send Vietnamese students to Japan to learn modern skills, so that in the future they could lead a successful armed revolt against the French. With Prince Cường Để, he started two organizations in Japan: Duy Tân Hội and Việt Nam Công Hiến Hội. Due to French diplomatic pressure, Japan later deported Châu. Phan Châu Trinh, who favored a peaceful, non-violent struggle to gain independence, led a second movement, Duy Tân (Modernization), which stressed education for the masses, modernizing the country, fostering understanding and tolerance between the French and the Vietnamese, and peaceful transitions of power. The early part of the 20th century saw the growing in status of the Romanized Quốc Ngữ alphabet for the Vietnamese language. Vietnamese patriots realized the potential of Quốc Ngữ as a useful tool to quickly reduce illiteracy and to educate the masses. The traditional Chinese scripts or the Nôm script were seen as too cumbersome and too difficult to learn. The use of prose in literature also became popular with the appearance of many novels; most famous were those from the Tự Lực Văn Đoàn literary circle .
As the French suppressed both movements, and after witnessing revolutionaries in action in China and Russia, Vietnamese revolutionaries began to turn to more radical paths. Phan Bội Châu created the Việt Nam Quang Phục Hội in Guangzhou, planning armed resistance against the French. In 1925, French agents captured him in Shanghai and spirited him to Vietnam. Due to his popularity, Châu was spared from execution and placed under house arrest until his death in 1940. In 1927, the Việt Nam Quốc Dân Đảng (Vietnamese Nationalist Party), modeled after the Kuomintang in China, was founded, and the party launched the armed Yên Bái mutiny in 1930 in Tonkin which resulted in its chairman, Nguyễn Thái Học and many other leaders captured and executed by the guillotine.
Marxism was also introduced into Vietnam with the emergence of three separate Communist parties; the Indochinese Communist Party, Annamese Communist Party and the Indochinese Communist Union, joined later by a Trotskyist movement led by Tạ Thu Thâu. In 1930, the Communist International (Comintern) sent Nguyễn Ái Quốc to Hong Kong to coordinate the unification of the parties into the Vietnamese Communist Party (CPV) with Trần Phú as the first Secretary General. Later the party changed its name to the Indochinese Communist Party as the Comintern, under Stalin, did not favor nationalistic sentiments. Being a leftist revolutionary living in France since 1911, Nguyễn Ái Quốc participated in founding the French Communist Party and in 1924 traveled to the Soviet Union to join the Comintern. Through the late 1920s, he acted as a Comintern agent to help build Communist movements in Southeast Asia. During the 1930s, the CPV was nearly wiped out under French suppression with the execution of top leaders such as Phú, Lê Hồng Phong, and Nguyễn Văn Cừ.
During World War II, Japan invaded Indochina in 1940, keeping the Vichy French colonial administration in place as a puppet. In 1941 Nguyễn Ái Quốc, now known as Hồ Chí Minh, arrived in northern Vietnam to form the Việt Minh Front, and it was supposed to be an umbrella group for all parties fighting for Vietnam's independence, but was dominated by the Communist Party. The Việt Minh had a modest armed force and during the war worked with the American Office of Strategic Services to collect intelligence on the Japanese. A famine broke out in 1944–45. Japan's defeat by World War II Allies created a power vacuum for Vietnamese nationalists of all parties to seize power in August 1945, forcing Emperor Bảo Đại to abdicate and ending the Nguyễn dynasty. Their initial success in staging uprisings and in seizing control of most of the country by September 1945 was partially undone, however, by the return of the French a few months later.