Between the 7th and 8th centuries, the Mengshe Kingdom and other five kingdoms as well as the Xi' erhe Ethnic Group formed in the vicinity of Er'hai Lake. All inhabitants in these kingdoms ethnically belonged to the Wuman (ancestors of the Yi) and, due to its location in the south of the kingdoms, the Mengshe Kingdom was historically known as the Kingdom of Nanzhao (Southern tribe, Zhao refers to tribe). In order to deal with the Tibetan regime, the Tang government attempted to support the rising Mengshe Kingdom in the southwestern frontier and even helped it to annex the other five kingdoms and the Xi'erhe Group. During the Kaiyuan Period (712-742) of Emperor Xuanzong, Piluoge, King or chieftain of the Mengshe Kingdom gradually unified the districts surrounding Erhai Lake and in the 26th year of that period (738 A.D), he was crowned by Emperor Xuanzong as King of Yunnan with a royal title "Guiyi", indicating that the Nanzhao Kingdom was finally established; the following year witnessed the shift of the capital of the kingdom to Taihe (a town south of Dali), and the political center of Yunnan at that time was accordingly shifted from Qujing to Dali. The territory of the kingdom, approximately one and a half times larger than that of the present Yunnan Province, included the whole province of Yunnan, West Guizhou, Southwest Sichuan, and even parts of Myanmar, Laos and Thailand. It was ruled by 13 kings with Xinuluo as its first king and lasted for 250 years until its termination in the year 902 A.D.
After the termination of Nanzhao came three transit dynasties, namely the Great Changhe Kingdom, the Great Tianxing Kingdom, and the Great Yining Kingdom, which together lasted for merely 36 years; during this period, the power of the noble Baiman kept rising steadily. From 937 A.D when the Kingdom of Dali was founded by Duan Siping, a Baiman aristocrat, to 1253 A.D when it was exterminated by Kublai Khan, the Dali Kingdom lasted for 316 years under successive reigns of 22 kings with a territory almost as large as that of the Kingdom of Nanzhao. Therefore, the kingdoms of Nanzhao and Dali existed at almost the same time as the Tang and Song dynasties did in the Central China.
Buddhism was introduced to Yunnan under the reign of King Xinuluo and culminated under the reign of the10th king Quan Fengyou when monasteries and temples were built across the kingdom: 800 major ones and 3,000 minor ones. The Buddhism practiced in Nanzhao belonged to the esoteric Tantric School, characterized by worship for Avalokitesvara (Guanyin or Goddess of Mercy), the Great Black Deva (Da Hei Tian Shen) and the Guardian King of the North. Buddhist worship thrived so well during the Kingdom of Dali that the whole country had became a land of Buddhas, and nine out of the 22 kings became Buddhists monks; innumerable monasteries and stupas were built, Avalokitesvara and Armitabha were worshiped in almost every household; this popularity of Buddhism had, no doubt, exerted a profound influence on the cultures of Nanzhao and Dali and some scholars, on account of this, have even declared that the cultures of Nanzhao and Dali are, by their very nature, Buddhist cultures.
From the immense buildings of pagodas, stupas, grottoes, and paintings left by the kingdoms of Nanzhao and Dali, the pervading influences of Buddhism on every aspect of the social life in that age is clear. The most vivid and convincing expression can be found in the Three Pagodas of Chongsheng Temple in Dali, Butuoluo (Yuantong) Temple, West and East Pagodas in Kunming, Buddhist Scripture Pillar at the Dizang Monastery (nowadays Kunming City Museum), White Pagoda in Dayao, the Pagoda on the Shuimu Mountain in Xiangyun, the Grottoes on the Shizhong Mountain in Jianchuan, the Grottoes in the Fahua Monastery in An'ning, the Scroll of Nanzhao Resurgence, and the Scroll by Zhang Shengwen.
According to the Unofficial History of Nanzhao, the construction of the Chongsheng Temple and the Qianxun Pagoda proved to be a forbidding task; altogether 800 houses were built along the four sides of the base that was seven miles long; over 40,000 kilograms of bronze was used to cast more than 10,000 statuettes of the Buddha, and more than 700,000 workers were requisitioned. And the Tripitaka Pavilion in Kunming, exquisite in both design and craftsmanship, "ranks among the best works of art ever produced in Central Yunnan."
The Scroll of Nanzhao Resurgence and the Scroll by Zhang Shengwen were regarded as the two most important paintings in the history of Yunnan, and became a part of the imperial collection of the Qing Court only after some adventures. The Scroll of Nanzhao Resurgence, 5.73 meters long and 0.3 meters high, was painted in the closing years of the kingdom. It seeks to publicize how the devout ancestors of Nanzhao followed Buddhism, and how they were aided by the bodily appearance of gods during the course of setting up their kingdom; the Scroll by Zhang Shengwen, painted by a royal painter of the Dali Kingdom, is about a Buddhist service held in the kingdom; in this grand painting, 16.36 meters long and 0.3 meters high were painted images of Buddhist gods, Buddhistsattvas, Ashta gatyahs, and other divine ancestors; this picture enchanted Emperor Qianlong (1736-1795) so much that he wrote nearly 500 characters in praise of it, it was even lauded with Bianjing Bazaar on Pure Brightness (Qingming Shanghe Tu), another famous scroll of its time, as "Dual Unique from North and South China." As well-known state-treasured paintings, they both occupy significant positions in the history of Chinese painting. Another two forms of religion related to the Nanzhao-Dali Culture were the "local god worship" popular in Nanzhao and the" patron god worship" as practiced in Dali.
On the Weibao Mountain in Weishan County, the birthplace of the Nanzhao Kingdom, stands the Mountain God Temple where Xinuluo, the local mountain god, has been enshrined. Legend goes that Xinuluo was enlightened by Supreme Master Lao and therefore became the local mountain god, revered only to Taoism in Yunnan; this stands for a transitional combination of Taoism with the primitive religions of the Wu'man before the newly introduced Buddhism became popular in Yunnan, and contains factors such as ancestor and hero admiration. Even to this day, the worship of local gods is a common practice among the Yi. The worship of "patron gods", a special religious belief that sprang up in the closing decades of the Dali Kingdom, is a collective worship of certain idols performed in the village unit. Put plainly, a "patron god" is a guardian of the local area or village in various forms; for instance, it can be an animal or plant such as a monkey, an ox, or an ancient tree; or it can be a historical figure such as Zheng Hui, Li Mi or even legendary figures such as Du Chaoxuan, and Duan Chicheng; it can further be a moral wife, a dutiful son or a skillful craftsman. This patron god worship has to do with nature worship, but it also involves such primitive concepts as the worship of ancestors and heroes; thus by nature it reflects a weakening adoration of esoteric Devas in Yunnan as a result of worshiping a patron god or "god for the local community" .This practice of patron god adoration is still very popular among the Bai people today.
Before the Sui and Tang dynasties (581-907 A.D), the Er'hai Lake area was economically less developed than the Dianchi Lake area and the eastern parts of Yunnan. Yet after a development of more than 500 years during the kingdoms of Nanzhao and Dali or the Tang and Song dynasties, the Bai and the Yi, the two major ethnic groups of the kingdoms, and other fellow groups, not only thrived economically around Er'hai Lake but also created the brilliant Nanzhao-Dali culture, thereby forwarding the course of the history of Yunnan and bringing about a new climax in the history of its culture.