After coming under attack by Nanzhao in 864, the Annan Protectorate was renamed Jinghai Military Command upon its reconquest by Gao Pian in 866.
Today the same area is sometimes known as Tonkin (Chinese: 東京; pinyin: Dōngjīng; Vietnamese: Đông Kinh), the "eastern capital" of Đại Việt.
Jiaozhou was the Han dynasty country subdivision formed from the annexation of this tributary kingdom in 111 BCE and it initially comprised the areas of modern Guangdong, Guangxi, and northern Vietnam.
In 676, jiedushi and governors of Guangxi, Guangdong and Jiaozhou established a method of selecting local men for administrative positions.
[4] 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][10] A Chinese army of 100,000 from Guangdong under general Yang Zixu, including a "multitude" of mountain tribesmen who had remained loyal to the Tang,[9] marched directly along the coast, following the old road built by Ma Yuan.
[11] 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.
[13]In 767, a Javanese raiding fleet invaded Annan, besieging Songping, but were defeated by Tang marquis Zhang Boyi.
Dương Thanh was unpopular due to his cruelty and put to death by the locals soon after,[17] however the region continued to experience disorders for the next 16 years.
[18][19] In 845, governor Wu Hun tried to get his troops to rebuild the city walls of Songping but they rebelled and forced him to flee.
[20] In 854, the new Jiedushi of Annan, Li Zhuo, provoked hostility with the mountain tribes by prohibiting the salt trade and killing powerful chieftains, resulting in the defection of prominent local leaders to Nanzhao.
[32] In 880, the army in Annan mutinied, taking the city of Đại La, and forced the military commissioner Zeng Gun to flee north, ending de facto Chinese control in Northern Vietnam.
[33][34] Since antiquity the peoples of Northern Vietnam had been noted for their common tattooing and cropped hair, wearing line ponchos, wielded wooden spears, and shot boneheaded arrows.
[35][36] Revival of direct Tang control over Annan for two centuries resulted in a hybrid Tang-indigenous culture, political and legal structures.
Wu Yantong (d. 820), a prominent Chinese monk in Annan, brought a new sect of Chan Buddhism that survived for about five centuries.
[40] Although Daoism became the dynasty's official religion, four prominent Tang poets praised Buddhist masters who hailed from Annan.
Liêu Hữu Phương was the only recorded student from Annan to have passed the classical exams in 816 in the Tang capital of Chang'an.
[42] Formerly the Buddha was born in Tianzhu [India],Now he manifests himself here to convert the people of Rinan.Free from all defilements,He built a temple at the foot of the mountain.By the stream the fragrant branches are the standards,The boulders on the mountaintop become his home.Blue doves practice meditation,White monkeys listen to the sutras.Creepers cover the cloud-high cliffs,Flowers rise above the pond at the foot of the mountain.The water in the streams is good for performing ritual,The trees let him hang his clothes on them.This disciple regrets that he is ignorant,Not able to discuss the Buddha's doctrine.Who one night crossed over the Tiger-stream,Amidst mountain fog under a lonely tree.