In 738 Piluoge, backed by the Tang, united the six zhao of the Erhai region and was invested prince of Yunnan, seating his court at Taihe (today's Dali) - the founding of Nanzhao. Under Geluofeng it fell out with Tang: the Tianbao wars twice destroyed Tang armies (751, 754); it then clung to Tibet before returning to the Tang fold, re-invested at the Zhenyuan accord. Under Yimouxun it modeled its offices on Tang institutions and honored Buddhism - the Nanzhao Scroll Paintings of its Zhongxing era survive. Holding Yunnan and the Yunnan-Burma trade roads, it raided Chengdu and Annam, the long tug-of-war with Tang draining both. In 902 the minister Zheng Maisui destroyed the Meng royal house and set up his own Dachanghe - Nanzhao ended, thirteen rulers and 165 years, and Yunnan entered its age of changing lordships.

Editorial note on dating Piluoge unified the six zhaos and received Tang investiture, alternating between war and alliance with the Tang; usurped by its minister in 902.