structural:reformatting
The Nguyễn dynasty (chữ Nôm: 茹阮, Vietnamese: Nhà Nguyễn; chữ Hán: 朝阮, Vietnamese: triều Nguyễn) was the last Vietnamese dynasty, which was preceded by the Nguyễn lords and ruled the unified Vietnamese state independently from 1802 to 1883 before being a French protectorate. During the independence period, Nguyễn Vietnam was a great power in Southeast Asia, especially under Emperor Minh Mạng. During its existence, the empire directly expanded into modern-day Cambodia and Laos and ended the existence of Champa through a continuation of the centuries-long Nam tiến and the Siamese–Vietnamese wars. Vietnamese territory peaked in the history from 1834 to 1841. The empire also used to implement a strong assimilation policy against ethnic minority and suppress Christianity. Unlike their ancestors, the Nguyễn dynasty applied a closed country policy and harsh Confucianism until the French came. With the French conquest of Vietnam, the Nguyễn dynasty was forced to give up sovereignty over parts of Southern Vietnam to France in 1862 and 1874, and after 1883 the Nguyễn dynasty only nominally ruled the French protectorates of Annam (in Central Vietnam) as well as Tonkin (in Northern Vietnam). They later cancelled treaties with France and were the Empire of Vietnam for a short time until 25 August 1945.

The House of Nguyễn Phúc was de jure subordinates of the Revival Lê dynasty in Hanoi but de facto independently ruled in southern territory as the Nguyễn lords (1558–1777, 1780–1802) before defeating the Tây Sơn dynasty and establishing their own imperial rule in the entire country in the early 19th century. The dynastic rule began with Gia Long ascending the throne in 1802, after ending the previous Tây Sơn dynasty. The Nguyễn dynasty was gradually absorbed by France over the course of several decades in the latter half of the 19th century, beginning with the Cochinchina Campaign in 1858 which led to the occupation of the southern area of Vietnam. A series of unequal treaties followed; the occupied territory became the French colony of Cochinchina in the 1862 Treaty of Saigon, and the 1863 Treaty of Huế gave France access to Vietnamese ports and increased control of its foreign affairs. Finally, the 1883 and 1884 Treaties of Huế divided the remaining Vietnamese territory into the protectorates of Annam and Tonkin under nominal Nguyễn Phúc rule, Nguyễn Vietnam became no longer a de jure vassal of Qing China but a colony of France. In 1887, Cochinchina, Annam, Tonkin, and the French Protectorate of Cambodia were grouped together to form French Indochina.

The Nguyễn dynasty remained the formal emperors of Annam and Tonkin within Indochina until the final stage of World War II. Japan had occupied Indochina with French collaboration in 1940, but as the war seemed increasingly lost, Japan overthrew the French administration in March 1945 and proclaimed independence for its constituent countries. The Empire of Vietnam under Emperor Bảo Đại was a nominally independent Japanese puppet state during the last months of the war and restored Vietnamese de jure rule in Southern Vietnam. It ended with the abdication of Bảo Đại following the surrender of Japan and August Revolution by the anti-colonial Việt Minh de facto led by the communists in August 1945. This ended the 143-year rule of the Nguyễn dynasty and 384-year rule of the House of Nguyễn Phúc.