|History of Vietnam
Annam (Chinese: 安南; pinyin: Ānnán; Vietnamese: An Nam) was the southernmost province of China during the Tang dynasty. Annam is the Vietnamese form of the Chinese name Annan, which means "the Pacified South" or "to pacify the South", a clipped form of the full name, the "Protectorate General to Pacify the South" Chinese: 安南都護府; pinyin: Ānnán Dūhùfǔ; Vietnamese: An Nam đô hộ phủ. This was one of a number of such protectorates formed by Tang China. Prior to the establishment of the protectorate, the area was known as Jiaozhou (Chinese: 交州; pinyin: Jiāozhōu) or Jiaozhi (Chinese: 交趾; pinyin: Jiāozhǐ; Vietnamese: Giao Chỉ). The same area is now sometimes known as Tonkin (Chinese: 東京; pinyin: Dōngjīng; Vietnamese: Đông Kinh), the "eastern capital" of the Lê dynasty, now modern Hanoi. Locally, the area is known as Bắc Kỳ (北圻), the "northern area".
The territory was conquered for the Qin dynasty by Zhao Tuo after the death of Qin Shi Huang. In the chaos surrounding the Chu–Han Contention, he declared its independence as Nanyue and ruled from Panyu (modern Guangzhou). 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 624 the Tang dynasty created the Jiaozhou Protectorate. In 627 the Jiaozhou Protectorate was put under the administration of Lingnan Circuit. In 679, the Annan Protectorate replaced the Jiaozhou Protectorate and was seated in Songping County (宋平縣) in present day Hanoi. The Annan Protectorate was renamed Zhennan Protectorate in 757. It was changed back to Annan Protectorate in 760. The Annan Protectorate came under attack from Nanzhao in 846 and the conflict lasted until 866, after which the Jinghai Army Jiedushi was created.
In 939, Ngô Quyền successfully expelled the Chinese at the Battle of Bạch Đằng where he beheaded the Commanding Admiral and Prince of the Southern Han dynasty, Liu Hongcao (劉弘操) and re-established the independent state of Đại Việt. This was the effective end of Annam as a Chinese province. Several attempts were made by various Chinese governments to retake Vietnam, with one succeeding (Ming rule of Vietnam) but only for 20 years (1407–1427).