Nanzhao encompassed many ethnic and linguistic groups. Some historians believe that the majority of the population were of the Bai people, but that the elite spoke a variant of Nuosu (also called Yi), a Tibeto-Burman language closely related to Burmese. The people of Nanzhao were sometimes known as the Black or White Mywa.
Originally, there were several tribes that settled on the fertile land around the alpine fault lake Erhai. These tribes were called Mengshe (蒙舍), Mengsui (蒙嶲), Langqiong (浪穹), Dengtan (邆賧), Shilang (施浪), and Yuexi (越析). Each tribe had its own kingdom, known as a zhao. In 704 the Tibetan Empire made these kingdoms into vassals or tributaries. In the year 737 AD, with the support of the Tang Dynasty of China, Piluoge (皮羅閣) united the six zhaos in succession, establishing a new kingdom called Nanzhao (Mandarin, "Southern Zhao"). The capital was established in 738 at Taihe, (the site of modern-day Taihe village, a few miles south of Dali). Located in the heart of the Erhai valley, the site was ideal: it could be easily defended against attack and it was in the midst of rich farmland.
In 748, Piluoge died and was succeeded by his son Geluofeng (閣羅鳳). When the Chinese prefect of Yunnan attempted to rob Nanzhao envoys in 750, Geluofeng attacked, killing the prefect and seizing nearby Tang territory. In retaliation, the Tang governor of Jiannan, Xianyu Zhongtong, attacked Nanzhao with an army of 80,000 soldiers in 751. He was defeated by Duan Jianwei (段俭魏) with heavy losses (many due to disease) at Xiaguan. Duan Jianwei's grave is two kilometres west of Xiaguan, and the Tomb of Ten Thousand Soldiers is located in Tianbao Park. In 754, another Tang army of 100,000 soldiers, led by General Li Mi (李宓), approached the kingdom from the north, but never made it past Mu'ege. By the end of 754, Geluofeng had established an alliance with the Tibetans against the Tang that would last until 794.
In 801 Nanzhao and Tang forces defeated a contingent of Tibetan and Abbasid slave soldiers.
Bolstered by these successes, Nanzhao expanded rapidly into Burma, conquering the Pyu city-states in the 820s, finally eliminating them in 832. In 829, they attacked Chengdu, but withdrew the following year. In the 830s, they conquered the neighboring kingdoms of Kunlun to the east and Nuwang to the south.
In 846, Nanzhao raided the southern Tang circuit of Annam. Relations with the Tang broke down after the death of Emperor Xuanzong in 859, when the Nanzhao king Shilong treated Tang envoys sent to receive his condolences with contempt, and launched raids on Bozhou and Annam. Shilong attacked Annam again in 863, occupying it for three years. In 869, he laid siege to Chengdu but failed to capture it.
By 873, Nanzhao had been expelled from Sichuan. They were driven from the Bozhou region, modern Guizhou, in 877 by a local military force organized by the Yang family from Shanxi. They retreated to Yunnan, after which the kingdom slowly declined. In 902, the dynasty came to a bloody end when the chief minister murdered all of the key members of the royal family, including the heir apparent. Three other dynasties followed in quick succession: Da Changhe (902–928), Da Tianxing (928–929) and Da Yining (929–937). Finally Duan Siping seized power in 937 to establish the Kingdom of Dali.
^Megan Bryson, "Baijie and the Bai: Gender and Ethnic Religion in Dali, Yunnan", Asian Ethnology 72, 2013, pp. 3-31
^Megan Bryson, "Mahākāla worship in the Dali kingdom (937-1253) – A study and translation of the Dahei tianshen daochang yi", Journal of the International Association of Buddhist Studies 35, 2012, pp. 3-69
^Thant Myint-U, Where China Meets India: Burma and the New Crossroads of Asia, Part 3
Andrade, Tonio (2016), The Gunpowder Age: China, Military Innovation, and the Rise of the West in World History, Princeton University Press, ISBN978-0-691-13597-7.
Asimov, M.S. (1998), History of civilizations of Central Asia Volume IV The age of achievement: A.D. 750 to the end of the fifteenth century Part One The historical, social and economic setting, UNESCO Publishing
Barfield, Thomas (1989), The Perilous Frontier: Nomadic Empires and China, Basil Blackwell
Beckwith, Christopher I (1987), The Tibetan Empire in Central Asia: A History of the Struggle for Great Power among Tibetans, Turks, Arabs, and Chinese during the Early Middle Ages, Princeton University Press
Bregel, Yuri (2003), An Historical Atlas of Central Asia, Brill
Coedès, George (1968), Walter F. Vella, ed., The Indianized States of Southeast Asia, translated by Susan Brown Cowing, University of Hawaii Press, ISBN978-0-8248-0368-1
Drompp, Michael Robert (2005), Tang China And The Collapse Of The Uighur Empire: A Documentary History, Brill
Yule, Henry (1915), Cathay and the Way Thither: Being a Collection of Medieval Notices of China, Vol I: Preliminary Essay on the Intercourse Between China and the Western Nations Previous to the Discovery of the Cape Route, Hakluyt Society