Long Biên (Vietnamese), also known as Longbian (< Eastern Han Chinese: *lioŋ-pian/pen;[1] Interweaving") was the capital of the Chinese Jiao Province and Jiaozhi Commandery during the Han dynasty. It was located on the Red River in modern-day Bac Ninh. After Ly Bi's successful revolt in AD 544, it served as the capital of Van Xuan. When the Sui dynasty of China retook the territory in 603, the Sui general Liu Fang moved the capital to nearby Tống Bình. Long Biên flourished as a trading port in the late 8th and early 9th centuries. Thăng Long was founded in 1010 at the site of earlier Chinese fortresses nearby. This grew into modern Hanoi, which incorporated Long Biên as one of its districts.
The name has been translated as "Dragons Interweaving" or "Dragon Twist", traditionally in reference to a jiao seen in the river shortly after the founding of the city. It was also known as Longyuan (Vietnamese: Long Uyên), briefly known as Longzhou in the 7th century, and known as "Dragon's Gulf". It was also known by the name of its city wall as Luocheng or La Thanh (; Wall"), although this name was later transferred to Songping after the Sui conquest in 602 and to a third site which became present-day Hanoi in the later 8th century. It is also sometimes anachronistically referenced as "Hanoi".
The capital of the early Vietnamese kingdom of Au Lac had been at Co Loa in present-day Hanoi's Dong Anh district. The area was conquered by the Qin dynasty general Zhao Tuo between 208 and 207 BC, a few years after the death of Qin Shi Huang. With China falling into chaos during the Chu–Han Contention, Zhao Tuo split off Nanhai Commandery as the separate state of Nanyue, which he ruled from Panyu (modern Guangzhou). In the 110s BC, the royal family of Nanyue mooted incorporating their realm as a principality of the Han dynasty. The local nobility reacted violently, killing King Zhao Xing, the Queen Dowager Jiushi (Chinese: 樛氏), and several Chinese diplomats. The first army sent by Emperor Wu under Han Qianqiu was defeated in 112 BC, but the next year a much larger force assembled under Lu Bode and Yang Pu, besieging Panyu, conquering the kingdom, and initiating the "First Northern Domination" of Vietnam.
The Han dynasty organised the region into a province, Jiao Province. Shi Dai administered it from Lianshou (Vietnamese: [[Liên Thụ]]) rather than Panyu. In 106 BC, this was moved to Guangxin (Vietnamese: Quảng Tín) in Cangwu Commandery. Long Biên is sometimes given as the provincial capital instead, but this did not occur until the time of Shi Xie in the transition between the Han dynasty and Three Kingdoms period. Long Biên was the capital of Jiaozhi Commandery and Longbian County, but it was not named before the erection of its citadel in AD 208. Jiao Province also held the commanderies of Nanhai, Cangwu, Yulin, Hepu, Jiuzhen, and Rinan. Jiaozhi also held the counties of Léilóu (Chinese: 羸, Vietnamese: Luy Lâu), Āndìng (Chinese: 安定, Vietnamese: An Định), Gǒulòu (Chinese: 苟屚, Vietnamese: Cẩu Lậu), Mílíng (Chinese: 麊泠, Vietnamese: [[Mê Linh District|Mê Linh]]), Qūyáng (Chinese: 曲昜, Vietnamese: Khúc Dương), Běidài (Chinese: 北帶, Vietnamese: Bắc Đái), Jīxú (Chinese: 稽徐, Vietnamese: Kê Từ), Xīyú (Chinese: 西于, Vietnamese: Tây Vu) and Zhūgòu (Chinese: 朱覯, Chu Cấu).
Long Biên was the major Chinese entrepôt for foreign trade in antiquity and is one of major contenders for Ptolemy's Cattigara. The local products were bananas, areca nuts, sharkskin, python bile and kingfisher feathers, although the district between it and Guangzhou was rich in silver, cinnabar and mercury. Cen Shen also wrote that the country "abounds in treasures and jewels". For the Chinese, it was mainly reached overland through the Gate of Ghosts—Han Yu noted that officials arrived "only after several months" of travel—while direct maritime trade with Guangzhou, Malaysia, and India was often in the hands of Arabs and Persians. In addition to maritime and overland routes to Guangzhou, there was a great road to Champa in the south. Another route—often disrupted by conflict—led northwest on the upper Red River and the "Clear River" through "Feng-chou" to Yunnan.
Deng Rang served as the grand administrator of Jiaozhi at the revival of the Han dynasty in AD 29. Su Ding was appointed grand administrator in 34. The revolt of the Trung Sisters from AD 40–43 was occasioned by the treatment they received by Su Ding (Chinese: 蘇定). They besieged the settlement as one of their first acts, taking the town and driving Su back to Nanhai. Their capital was at nearby Me Linh. Ma Yuan, assisted by Liu Long and Duan Zhi, defeated them at Langbo (Vietnamese: [[Tây Hồ]]) in 42 and defeated and captured them in 43. The period following their defeat is reckoned as the "Second Northern Domination" in Vietnamese history.
During the Three Kingdoms period, the grand administrator of Jiaozhi Commandery, Shi Xie, declared allegiance to Sun Quan, the emperor of the Eastern Wu state, and sent his eldest son Shi Xin (Chinese: 士廞) as a hostage to Sun Quan to convince the emperor of his loyalty. Using the area's thriving foreign trade, Shi Xie provided large amounts of tribute and eventually seated his three brothers Shi Yi (Chinese: 士壹), Shi Hui (士䵋) and Shi Wu (Chinese: 士武) as grand administrators over the neighbouring commanderies of Hepu, Jiuzhen, and Nanhai. He received the noble title and fostered Buddhism in his territories, for which he is still worshipped under the name "King Si" (Vietnamese: Sĩ Vương). After Shi Xie's death in 226, Sun Quan divided Jiao Province, creating a new Guang Province from Jiao Province's northern commanderies. Shi Xie's third son, Shi Hui (Chinese: 士徽), attempted to resist this move by seizing control of Jiaozhi Commandery and opposing Dai Liang (Chinese: 戴良), whom Sun Quan had appointed as the governor of Jiao Province. Huan Lin (Chinese: 桓鄰), one of Shi Hui's subordinates, spoke in favour of surrendering to the legitimate administrator but ended up being killed by Shi Hui; Huan Lin's nephew, Huan Fa (Chinese: 桓發), then led his men to besiege Jiaozhi Commandery for months. Shi Hui's cousin, Shi Kuang (Chinese: 士匡), managed to convince Shi Hui to surrender when Sun Quan's forces, led by the general Lü Dai, showed up at Jiaozhi Commandery. Lü Dai pretended to accept Shi Hui's surrender, then later had him and his brothers executed and the rest of the Shi family reduced to commoner status. In 248, Lady Triệu and others rebelled, but most were bought off by Lu Yin (Chinese: 陸胤) and the revolt collapsed.
At the establishment of the Jin dynasty in 280, Yin Ju was appointed grand administrator over Jiaozhi at Long Biên. Bu Zhi reunited Jiao and Guang provinces, but kept the capital in the latter.
After Ly Bi's successful revolt in AD 544, it was the capital of Van Xuan.
The Sui general Liu Fang retook the area in 603, removing the Chinese administration to Songping (Vietnamese: Tông Binh) on the south shore of the Red River. Long Biên and Tông Binh were elevated to county or prefecture status under the names "Longzhou" and "Songzhou" in 621 but these were abolished only a few years later. This period is known as the "Third Northern Domination".
Under the Tang dynasty, the area was organised as Annam and administered from Jiaozhi. The road to Guangzhou was reopened in 622 through negotiations which left the local Ning tribesmen in control of the nominally Chinese counties in the area. The Chinese administration was largely staffed with mandarins banished from other areas of China. Many were killed en route or succumbed to tropical diseases. Long Biên prospered in the second half of the 8th century and early 9th century not so much on its own merits but owing to corruption at Guangzhou, continuing despite a major Arab and Persian raid on the city in 758. and subsequent corruption there that diverted a great deal of the foreign trade to the Red River. The Chinese garrisons in the country repeatedly mutinied during the 9th century.
At the establishment of the Lý dynasty, the capital was renamed Thăng Long, which name was revived by the later Trần and Lê dynasties.