In 602 when Ly Phat Tu openly rebelled, Emperor Wen of Sui deployed General Liu Fang and 27,000 troops, conquering the region.
[2][3] In 605, Yang Jian pushed further south, invaded the Cham Simhapura kingdom in central Vietnam, briefly set up an administration and divided the country into 3 counties: Tỷ Ảnh, Hải Âm and Tượng Lâm.
[5] A local ruler of Jiuzhen (today's Thanh Hóa), Lê Ngọc, stayed loyal to Xiao Xian and fought against the Tang for another three years.
Taxation was more moderate than within the empire proper; the harvest tax was one-half the standard rate, an acknowledgement of the political problems inherent in ruling a non-Chinese population.
[9] For the first time since the Han dynasty, Chinese schools were built, and dykes were constructed to protect the capital city of Songping (later Đại La).
[14] In 687, the Li chief Lý Tự Tiên rebelled against Tang authority due to the governor of Annan, Liu Yanyou, doubled the taxes.
The corpses of the Swarthy Emperor and his followers were piled up to form a huge mound and were left on public display to check further revolts.
[18][19] Later from 726 to 728, Yang Zixu suppressed other rebellions of Li and Nung peoples led by Chen Xingfan and Feng Lin in the north, who proclaimed the title "Emperor of Nanyue", causing another 80,000 deaths.
[21] In 785, chieftains of the indigenous, Đỗ Anh Hàn and Phùng Hưng, rebelled due to Tang governor Gao Zhengping's doubling of taxes.
Dương Thanh was unpopular due to his cruelty and put to death by the locals soon after, however the region continued to experience disorders for the next 16 years.
[25] In 854, the new governor of Annan, Li Zhuo, provoked hostiles and conflicts with the mountain tribes by reducing the salt trade and killing powerful chieftains, resulting in the defection of prominent local leaders to the Nanzhao Kingdom.
In the same year the Tang court responded by appointing Wang Shi as the military governor of Annan, aiming to restore order, strengthen the defense of Songping.
He rebuilt the citadel in Songping, named it Đại La, repaired 5,000 meters of damaged city wall, and reconstructed 400,000 bays for its residents.
In 880, the army in Annan mutinied, took the city of Đại La, and forced the military commissioner Zeng Gun to flee, ending de facto Chinese control in Vietnam.
At that point the region was probably still very diverse in terms of ethno-linguistics with a predominance of Kra-Dai and Austroasiatic-speaking peoples, who have since been marginalized by Chinese and Vietnamese histories, as historian and archaeologist John N. Miksic speculates.
[39] In late 931, Duong Dinh Nghe, a noble from Aizhou (Thanh Hoa) who was much less sinicized than the Khucs revolted and ousted Southern Han.
Ngo Quyen, son-in-law of Duong, quickly overthrew of the revanchist leaders and defeated the meddling Southern Han fleet in the Battle of Bạch Đằng River in late 938.
[42] Revival of direct Tang control over northern Vietnam for two centuries resulted in a hybrid Tang-indigenous culture, political and legal structures.