[3] The Annan Protectorate (now northern Vietnam), with its capital city of Songping, was a center of commerce on the Maritime Silk Road and a rice basket of the Tang empire at the time.
When Li Zhuo became jiedushi of Annan in 854, he reduced the amount of salt traded to the Chongmo Man in Fengzhou (modern-day Phú Thọ and Hòa Bình Province) in the west in exchange for horses.
[4] In the next year, Li Zhuo killed Đỗ Tồn Thành as well as the chieftain of the Qidong Man in Aizhou (Nghệ An, central Vietnam).
Fan Chuo, a Tang official in Annan reported: "…The native chiefs within the frontiers were subsequently seduced by the Man rebels…"[5] and "again became close friends with them.
Moreover, the routes from the Yong and Rong prefectures pass through the aboriginal region [xidong] inhabited by the Nùng clan.The matters of the South require a strategy for their management.
General Li subsequently was forced to rely on his troops, and with these added expenditures he found it difficult to provide his tribute to the court.
[6]In modern-day Phú Thọ and Hòa Bình Province on the western frontier of the protectorate, the local general Lý Do Độc who led an army of 6,000 and was assisted by seven commanders called "Lords of the Ravines", submitted to Nanzhao.
[4] The Nanzhao king Meng Shilong (蒙世隆) sent a Trustee of the East to deliver a letter to Do Độc soliciting his submission.
One evening they surrounded Songping and demanded that Wang Shi return north and allow them to fortify the city against the Yellow Head Army.
[10] Anti-Tang Viets allied with highland people, who appealed to Nanzhao for help, and as a result invaded the area in 860, briefly taking Songping before being driven out by a Tang army the next year.
When Li Hu led an army to retake Bozhou, the Đỗ family gathered 30,000 men, including contingents from Nanzhao to attack the Tang.
[15] Much of the information about the battle was written by Fan Chuo, a Tang official who wrote an eyewitness account about the southern barbarians (people of Annan and Yunnan) during the siege.
[16] In mid-January of 863, Nanzhao returned with an invasion force numbering 50,000 led by Duan Qiuqian and Yang Sijin and besieged Annan's capital Songping.
[20] On 28 January, a naked Buddhist monk, possibly Indian, was wounded in the breast by an arrow shot by Cai Xi while strutting to and fro outside the southern walls.
A Nanzhao and rebel fleet of 4,000 men led by a chieftain named Chu Đạo Cổ (Zhu Daogu, 朱道古) was attacked by a local commander, who rammed their vessels and sank 30 boats, drowning them.
[23] Ten thousand soldiers from Shandong and all other armies of the empire were called and concentrated at Halong Bay for reconquering Annan.
[24] The Tang launched a counterattack in 864 under Gao Pian, a general who had made his reputation fighting the Türks and the Tanguts in the north.
[26] Gao completed the retaking of Annan in fall 866, executing the enemy general, Duan Qiuqian, and beheading 30,000 of his men.
[23] Gao Pian rebuilt the capital citadel, repairing 5,000 meters of damaged wall, reconstructing 400,000 bays for its residents, and named it Đại La.
This may well have sealed the separation of Muong from Vietnamese, which historians such as Henri Maspero suggest based on linguistic evidence took place at the end of Tang rule in Annan.
[32] 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.