The –ĐạiViệSong–Đại Việt war, also known as the Lý-Song War, was a military conflict between the Lý dynasty of Đại Việt and the Song dynasty of China between 1075 and 1077. The war was sparked by the shifting allegiances of tribal peoples such as the Zhuang/Nùng on the frontier borderlands, and increasing state control over their administration. In 1075, Emperor Lý Nhân Tông ordered a preemptive invasion of Song dynasty territory with more than 80,000 soldiers, razing the city of Yongzhou after a 42-day siege. The Song retaliated with an army of 300,000 the following year. In 1077, Song forces nearly reached Đại Việt's capital Thăng Long before being halted by General Lý Thường Kiệt at the Như Nguyệt River in modern-day Bắc Ninh Province.
After a prolonged stalemate and high casualties on both sides, Lý Thường Kiệt offered apologies for the invasion and the Song commander Guo Kui agreed to withdraw his troops, ending the war. Further negotiations were held in the following years that consolidated the border between the two empires.
Background
Nùng Trí Cao rebellions
In the 1040s and 1050s, the Nong Zhigao rebellions of the Zhuang/Nùng leader Nùng Trí Cao (C. Nong Zhigao) in Quảng Nguyên (C. Guangyuan; now Cao Bằng Province) and his attempt to create an independent state on the borderlands of Đại Cồ Việt and the Song dynasty led to intensified relations between the two states. Nùng Trí Cao's failed rebellions and defeat by Viet forces and the Song general Di Qing (1008–1061) resulted in the removal of the tribal buffer zone between Đại Cồ Việt and the Song. His final defeat by the Song also had the effect of subordinating a large portion of that zone to direct Song control. The Viet court did not intervene in the matter and for 20 years after the Nùng Trí Cao rebellions, there was general peace along the border. However the regional power balance had been lost. Han Chinese military settlers moved in and new leaders took over the surviving communities. Several influential Nùng leaders sided with the Viet court. Crucial influences for the lead up to the event include the Song-court sponsored New Policies promoted by Wang Anshi and efforts by the Lý court to consolidate peripheral fiefdoms.
The Song and Đại Cồ Việt treated their frontier borderland peoples in different ways. Traditionally the Chinese Jimi system sought to introduce "uncultured" barbarians to the benefits of the "civilized" center. Viet leadership on the other hand created "patron-client" relationships using marriage alliances and military expeditions to maintain "satellite" partners. Successive Viet courts saw the extraction of resources from frontier vassals as a measurement of their efficacy. However by the 11th century, both the Chinese and Viet courts saw the frontier as a source of available troops famed for their ferocity. By 1065, around 44,500 militia had been recruited from these communities by the Song.
Song expansion
Frontier unrest began anew in 1057 when Nùng Tông Ðán (C. Nong Zongdan), a kinsman of Nùng Trí Cao, entered Song territory. The frontier administrator Wang Han visited Nùng Tông Ðán's camp at Leihuo to discourage him from seeking inclusion in the Song dynasty since it would upset the Viet court. Instead he proposed that he stay outside Song territory as a loyal frontier militia leader. Wang feared that a resurgence of the Nùng clan would spell trouble for the frontier. The Song court ignored his apprehensions and offered the Nùng and other communities "Interior Dependency" status. By 1061, Emperor Renzong of Song (r. 1022-63) was regretting his decision and lamented that the "Nùng Bandit" and his kin had strayed far from their frontier duties and might never be incorporated into the Song administration. However in 1062 when Nùng Tông Ðán requested his territory be incorporated into the Song empire, Renzong accepted his request. According to The Draft Documents Pertaining to Song Official Matters, Nùng Tông Ðán was regarded by the Song as the prefect of Leihuo prefecture, renamed "Pacified Prefecture" (Shun'anzhou), and possessed the title "Personal Guardian General of the Right." Nùng Trí Hội (C. Nong Zhihui) the brother of Nùng Trí Cao, received the title "Personal Guardian of the Left." Other members of the Nùng clan in Temo such as Nùng Binh, Năng Lượng, and Nùng Hạ Khanh swore loyalty to the Song. Nùng Trí Cao's former generals Lư Báo, Lê Mạo, and Hoàng Trọng Khanh were also granted official titles.