Independent period of Đại Việt (1010 AD – 1527 AD)
When the king Lê Long Đĩnh died in 1009 AD, a Palace Guard Commander named Lý Công Uẩn was nominated by the court to take over the throne, and founded the Lý dynasty. This event is regarded as the beginning of a golden era in Vietnamese history, with great following dynasties. The way Lý Công Uẩn ascended to the throne was rather uncommon in Vietnamese history. As a high-ranking military commander residing in the capital, he had all opportunities to seize power during the tumultuous years after Emperor Lê Hoàn's death, yet preferring not to do so out of his sense of duty. He was in a way being "elected" by the court after some debate before a consensus was reached.
Lý Công Uẩn, posthumously referred as Lý Thái Tổ, changed the country's name to Đại Việt (Hán tự: 大越; literally "Great Viet"). The Lý Dynasty is credited for laying down a concrete foundation, with strategic vision, for the nation of Vietnam. Leaving Hoa Lư, a natural fortification surrounded by mountains and rivers, Lý Công Uẩn moved his court to the new capital in present-day Hanoi and called it Thăng Long (Ascending Dragon). Lý Công Uẩn thus departed from the militarily defensive mentality of his predecessors and envisioned a strong economy as the key to national survival. Successive Lý kings continued to accomplish far-reaching feats: building a dike system to protect the rice producing area; founding Quốc Tử Giám, the first noble university; holding regular examinations to select capable commoners for government positions once every three years; organizing a new system of taxation; establishing humane treatment of prisoners. Women were holding important roles in Lý society as the court ladies were in charge of tax collection. The Lý Dynasty also promoted Buddhism, yet maintained a pluralistic attitude toward the three main philosophical systems of the time: Buddhism, Confucianism, and Taoism. During the Lý Dynasty, the Chinese Song Dynasty officially recognized the Đại Việt monarch as King of Giao Chỉ (Giao Chỉ Quận Vương).
The Lý Dynasty had two major wars with Song China, and a few conquests against neighboring Champa in the south. The most notable battle took place on Chinese territory in 1075 AD. Upon learning that a Song invasion was imminent, the Lý army and navy totalling about 100,000 men under the command of Lý Thường Kiệt, Tông Đản used amphibious operations to preemptively destroy three Song military installations at Yong Zhou, Qin Zhou, and Lian Zhou in present-day Guangdong and Guangxi, and killed 100,000 Chinese. The Song Dynasty took revenge and invaded Dai Viet in 1076, but the Song troops were held back at the Battle of Như Nguyệt River commonly known as the Cầu river, now in Bắc Ninh province about 40 km from the current capital, Hanoi. Neither side was able to force a victory, so the Lý Dynasty proposed a truce, which the Song Dynasty accepted.
Toward the end of the Lý Dynasty, a powerful court minister named Trần Thủ Độ forced king Lý Huệ Tông to become a Buddhist monk and Lý Chiêu Hoàng, Huệ Tông's young daughter, to become queen. Trần Thủ Độ then arranged the marriage of Chiêu Hoàng to his nephew Trần Cảnh and eventually had the throne transferred to Trần Cảnh, thus begun the Trần Dynasty. Trần Thủ Độ viciously purged members of the Lý nobility; some Lý princes escaped to Korea, including Lý Long Tường.
After the purge most Trần kings ruled the country in similar manner to the Lý kings. Noted Trần Dynasty accomplishments include the creation of a system of population records based at the village level, the compilation of a formal 30-volume history of Đại Việt (Đại Việt Sử Ký) by Lê Văn Hưu, and the rising in status of the Nôm script, a system of writing for Vietnamese language. The Trần Dynasty also adopted a unique way to train new kings: as a king aged, he would relinquish the throne to his crown prince, yet holding a title of August Higher Emperor (Thái Thượng Hoàng), acting as a mentor to the new Emperor

