Đại Việt (, ; literally Great Việt), often known as Annam (, Chữ Hán: 安南), was a monarchy in eastern Mainland Southeast Asia from the 10th century AD to the early 19th century, centered around the region of present-day Hanoi, Northern Vietnam. Its early name, Đại Cồ Việt, was established in 968 by Vietnamese ruler Đinh Bộ Lĩnh after he ended the Anarchy of the 12 Warlords, until the beginning of the reign of Lý Thánh Tông (r. 1054–1072), the third emperor of the Lý dynasty. Đại Việt lasted until the reign of Gia Long (r. 1802–1820), the first emperor of the Nguyễn dynasty, when the name was changed to Việt Nam. Đại Việt's history is divided into the rule of eight dynasties: Đinh (968–980), Early Lê (980–1009), Lý (1009–1226), Trần (1226–1400), Hồ (1400–1407), and Later Lê (1428–1789); the Mạc dynasty (1527–1677); and the brief Tây Sơn dynasty (1778–1802). It was briefly interrupted by the Hồ dynasty (1400–1407), who changed the country's name briefly to Đại Ngu, and the Fourth Era of Northern Domination (1407–1427) when the region was administered as Jiaozhi by the Ming dynasty. Đại Việt's history can also be divided into two periods: unified empire, which lasted from 960s to 1533, and fragmented from 1533 to 1802, when there were more than one dynasty and noble clans simultaneously ruling from their own domains. From the 13th to 18th century, Đại Việt's borders expanded to encompass territory that resemble modern-day Vietnam, which lies along the South China Sea from the Gulf of Tonkin to the Gulf of Thailand. Early Đại Việt emerged in the 960s as a hereditary monarchy with Mahayana Buddhism as state religion, and lasted for 6 centuries. From the 16th century, Đại Việt gradually weakened and decentralized into multiple sub-kingdoms and domains, ruled by either the Lê, Mạc, Trịnh, Nguyễn families simultaneously. It was briefly unified by the Tây Sơn brothers in 1786, who divided among themselves in 1787. After the Trịnh-Nguyễn War which ended in Nguyễn victory and destruction of the Tây Sơn, Đại Việt was reunified, ending 300 years of fragmentation. From 968 to 1804, Đại Việt flourished and acquired significant power in the region. The state slowly annexed Champa and Cambodia's territories, expanding Vietnamese territories to the south and west. The Empire of Đại Việt is the primary precursor to the country of Vietnam and the basis for its national historic and