Army and warfare made their first appearance in Vietnamese history during the 3rd millennium BC. Throughout thousands of years, wars played a great role in shaping the identity and culture of people inhabited the land which is modern day Vietnam.
Early period
From the beginning of the founding of the Vietnamese Nation in the 1st millennium BC, the Hùng Vương period spawned many legends of fighting against seaborne invasions of Quynh Chau (now China) from the north and Ho Ton (later to become Champa) from the south. During the era of the Kingdom of Âu Lạc, when the Cổ Loa Citadel was constructed, King An Dương Vương relied on the Hoang Giang River as a natural fortification to protect the south flank of the citadel. In the 6th century, Emperor Lý Nam Đế built naval forces to fend off the invasion of Liang dynasty's (China) forces in the Tô Lịch River, Dien Triet lake; and then, King Triệu Quang Phục used guerrilla tactics against the Chinese military at Da Trach lagoon (Khoái Châu, Hải Dương).
In the 10th century, the Imperial Vietnamese Navy became a regularised force. Naval forces of Khúc Thừa Dụ in Hong Chau (now Ninh Giang District, Hải Dương), Dương Đình Nghệ in Ai Chau, Thanh Hóa and of King Ngô Quyền himself were raised by enlisting and training the fishermen along rivers and seasides. Those elements became well-trained and experienced naval forces, ready to protect the country.
Dynastic period
In Lý–Trần dynasty era, the dynasties were occupied with raising naval forces and naval bases. Particularly, the Vân Đồn port had an important role in protecting the northeast territorial waters of Vietnam. In 1075 Lý Thường Kiệt mobilised a fleet to ferry 50,000 marines across the Gulf of Tonkin to invade Qinzhou, China. The amphibious assault was well planned and executed with incredible speed that Qinzhou's garrison was totally taken by surprise. The fortress town was taken in one night.
To retaliate, the Song dynasty of China mustered a huge invasion force, with a naval arm to provide support to land operations. They were already fearful of Vietnam's reputation at sea combat, thus a large enough force was organised so as to "not lose even if they can't score a win". Lý Kế Nguyên, a Vietnamese commander stationed in Vân Đồn, Quảng Ninh, however, had absolute confidence in his fleet that he went on the offensive and took on the Chinese invasion fleet on the high sea. Lý defeated the Chinese so badly that their admiral sent messengers to urge Chinese coastal guards to fortify their post in fear of a reverse-invasion.
In 1077, the Imperial Vietnamese Navy fought the Battle of Cầu River against the Chinese Song dynasty forces. This was the final battle Song dynasty would fight on Vietnamese land or waters. The battle lasted for several months, and ended with the victory of the Vietnamese Navy and the loss of many Song sailors. This victory demonstrated the successful tactics of war and active defence of the famous Admiral Lý Thường Kiệt who faced a naval force numerically superior to his own. The Song dynasty lost a total of 8,000 soldiers/sailors and 5.19 million ounces of silver, including all costs of the war.
The Đại Việt sử ký toàn thư records that in 1467 in An Bang province of Đại Việt (now Quảng Ninh Province) a Chinese ship blew off course onto the shore. The Chinese were detained and not allowed to return to China as ordered by Emperor Lê Thánh Tông. This incident may be the same one where Wu Rui was captured. One of the renowned victories in Vietnamese naval history was the Battle of Rạch Gầm-Xoài Mút in Tây Sơn dynasty, during which Nguyễn Huệ (Emperor Quang Trung) defeated the Siamese (Thai) naval force. The battle occurred in present-day Tiền Giang Province on 19 January 1785. Nguyễn Huệ's forces completely destroyed over 50,000 Siamese sailors and 300 warships.
In the Nguyễn dynasty period, 19th century Nguyen Emperor Gia Long used his new Chu Su Naval workshop to improve the Vietnamese Navy. Gia Long had first attempted to acquire modern naval vessels in 1781, when on the advice of Bishop Pigneau de Behaine, he had chartered Portuguese vessels of European design, complete with crew and artillery. This initial experience proved to be disastrous. For reasons that remain unclear, two of the vessels fled in the midst of battle against the Tây Sơn, while angry Vietnamese soldiers killed the third crew.