Song–Đại Cồ Việt war

The Song–Đại Cồ Việt war was a military conflict between the Song dynasty and Đại Cồ Việt in 981. It resulted in a victory for Đại Cồ Việt over the Song forces.

Background
In the late 9th century, the then-Tang dynasty administered territory of Jinghai Circuit slipped away from Chinese control and a succession of local Viet chieftains and warlords ruled it autonomously until 939 when Ngô Quyền abolished the circuit and proclaimed himself king. Their power waned with Ngô Quyền's death in 944 and a civil war in 958 that split the realm into the domains of twelve warlords. In 968, Đinh Bộ Lĩnh, a warlord based in Hoa Lư, defeated the other warlords and named the realm Đại Cồ Việt. The Song dynasty bestowed titles upon Đinh Bộ Lĩnh such as the King of Jiaozhi (quận vương), King of Annam province, and Peaceful Sea Military Governor. In 971, the Song emperor ordered the subjugation of Lingnan (the lands south of the passes), which implicitly included Đại Cồ Việt. Đinh Liễn, who was recognized as the ruler of Đại Cồ Việt though his father Đinh Bộ Lĩnh held the real reins of power, requested his own title as a vassal of the Song court. The Song emperor duly named him Imperial Commissioner and Prefect-General of Annam and later promoted him to Prince of Jiaozhi.

In October 979, a eunuch named Đỗ Thích killed both Đinh Bộ Lĩnh and Đinh Liễn while they slept. The general Lê Hoàn took power as regent in the name of the five-year old Đinh Toàn, Đinh Bộ Lĩnh's youngest son. Rebellions soon swept the countryside. In addition, the Song dynasty sent troops under Hou Renbao to invade Đại Cồ Việt under the pretext of removing threats to the young emperor's rule. In response the Viet court urged Lê Hoàn to become king, pacify the countryside, and prepare for the Song invasion. In 980, officials and generals gathered at Hoa Lư and the queen dowager Dương Vân Nga brought out the king's robe to put on Lê Hoàn, crowning him king.

Course
In early 981, two Song armies attacked Đại Cồ Việt through land, and a fleet of ships sailed up the Bạch Đằng River. Lê Hoàn's met the Song fleet on the river, but were greatly outnumbered and forced to retreat. The victorious Song fleet captured and beheaded 1,000 Viet sailors and seized 200 junks. Malaria struck the Song army and around 20% to 30% of the expedition forces died. The expedition force began to disintegrate as the leaders started quarreling with each other. Lê Hoàn took to the land and led his army to the north, attempting to stop the Song armies by ambushing them at Chi Lăng (near modern-day Lạng Sơn). The ambush was successful with two Song generals captured and half of the Song force killed. As a result, the Song fleet was forced to withdraw and the Song invasion ended in April 981.

Aftermath
After the war, Lê Hoàn returned the two Song generals and requested to renew tributary relations with Song dynasty, and the Song accepted the offer. A Song delegation arrived in Đại Cồ Việt in 990. In 993, Lê Hoàn was given the title King of Jiaozhi Prefecture, and in 997, was also accorded the title Nam Bình Vương (King of Southern Peace). With the Song threat diminished, Lê Hoàn began the Viet southward advance against Champa, which in 979 failed in an attempt to invade Đại Cồ Việt with the support of Ngô Nhật Khánh, a former Ngô prince.