In 906 the Tang recognized Vietnam as an autonomous state, however a year later the Tang dynasty ended when Zhu Wen overthrew Tang rule establishing the Later Liang Dynasty for himself and ushering in the division of China into the short-lived empires of the Five Dynasties and Ten Kingdoms period.
During this time of civil wars in China, the Khúc clan attempted to increase its power and control over Vietnam.
In Guangzhou province of south China, however, the former Tang governor, Liu Yan declared himself the emperor of the emergent Southern Han kingdom.

In 917, Khúc Thừa Mỹ succeeded Khúc Hạo as Jiedushi of Tĩnh Hải Quân and reached out to the Liang Dynasty in northern China seeking political support as a vassal state.
Such an action angered the Southern Han and in 930 emperor Liu Yan attempted to bring Tĩnh Hải Quân under his control by invading the capital city and taking Khúc Thừa Mỹ captive.
Shortly thereafter, however, Dương Đình Nghệ, the Governor of the Ái Châu district of Tĩnh Hải Quân sent troops to rescue Khúc Thừa Mỹ, defeated the Southern Han army, and in the process appointed himself as Jiedushi of Tĩnh Hải Quân.
In 937, Dương Đình Nghệ was assassinated by his general Kiều Công Tiễn who declared himself loyal to the Southern Han's emperor.
Immediately thereafter, Dương Đình Nghệ's son in law, general Ngô Quyền who was governing the Ái district, initiated hostilities against Kiều Công Tiễn
In 906 the Tang recognized Vietnam as an autonomous state, however a year later the Tang dynasty ended when Zhu Wen overthrew Tang rule establishing the Later Liang Dynasty for himself and ushering in the division of China into the short-lived empires of the Five Dynasties and Ten Kingdoms period. During this time of civil wars in China, the Khúc clan attempted to increase its power and control over Vietnam. In Guangzhou province of south China, however, the former Tang governor, Liu Yan declared himself the emperor of the emergent Southern Han kingdom. 
In 917, Khúc Thừa Mỹ succeeded Khúc Hạo as Jiedushi of Tĩnh Hải Quân and reached out to the Liang Dynasty in northern China seeking political support as a vassal state. Such an action angered the Southern Han and in 930 emperor Liu Yan attempted to bring Tĩnh Hải Quân under his control by invading the capital city and taking Khúc Thừa Mỹ captive. Shortly thereafter, however, Dương Đình Nghệ, the Governor of the Ái Châu district of Tĩnh Hải Quân sent troops to rescue Khúc Thừa Mỹ, defeated the Southern Han army, and in the process appointed himself as Jiedushi of Tĩnh Hải Quân. In 937, Dương Đình Nghệ was assassinated by his general Kiều Công Tiễn who declared himself loyal to the Southern Han's emperor. Immediately thereafter, Dương Đình Nghệ's son in law, general Ngô Quyền who was governing the Ái district, initiated hostilities against Kiều Công Tiễn
Ngô dynasty