As a youngster growing up in Hoa-Lư Nguyễn Bặc befriended Đinh Bộ Lĩnh, and eventually they and another village kid named Đinh Điền, Trịnh Tú and Lưu Cơ.In their early teenage years the three sworn-brothers and children of neighboring villages achieved notoriety for constantly playing war-games.
In the early 960s Vietnam was thrust into chaos due to the petty wars of the Twelve Feudal-Warlords (Thập-nhị Sứ-quân).
Because of their weaknesses Đinh Bộ Lĩnh decided to lead his followers into an alliance with an ethnic Chinese named Trần Lãm, the feudal warlord who had control of Bố-hải Port, the commercial center of the kingdom.
Trần Lãm, who was more concerned with the commercial prospects of the conquest than with the unification of Vietnam, gladly and financial supported Đinh Bộ Lĩnh's ambitious plan.
When Emperor Đinh Bộ Lĩnh and his heir apparent fell victims to an imperial attendant's sword in 979 A.D., the shocked and furious Nguyễn Bặc beheaded Đỗ Thích, the assassin, then had the corpse ground up for consumption by the people of Hoa-Lư.
With the Queen-Mother's support Lê Hoàn quickly declared himself Viceroy (Nhiếp-Chính), and began plotting a coup d'état.
Upon receiving news of the plot, Nguyễn Bặc and Đinh Điền, both were in Ái Province (Thanh-Hóa) at the time, promptly returned to court with their forces.
Naturally, the disgusted Nguyễn Bặc and his sworn-brother, Đinh Điền, declined and civil war once again erupted.
Lê Hoàn, as commander-in-chief of the main imperial army, easily crushed the Đinh loyalists headed by Nguyễn Bặc.
Nguyễn Bặc was captured and executed on the bank of the Chanh River outside the citadel of Hoa-lư on 8 November 979 A.D. (October 15 of the lunar calendar).
The Sung dynasty of China refused to recognize Lê Hoàn and launched an invasion of Vietnam the following year.
However, Lê Hoàn refused to submit and rallied the great army that Đinh Bộ Lĩnh had built to face the Chinese expeditionary forces.
News of the routing of the land forces compelled the Chinese invading fleet to flee back to China.
To remember their virtues and loyalty, the Vietnamese villagers deified the three sworn-brothers like Liu Bei (Lưu Bị), Guan Yu (Quan Vũ) and Zhang Fei (Trương Phi) of China and had temples built in their names.
King Chey Chetta II granted Princess Nguyễn Thị Ngọc Vạn's wish and allowed Vietnamese natives to settle in Mô Xoài (Bà Rịa).