By the 730s Nanzhao had succeeded in bringing the Erhai Lake–area under its authority. In 738, the western Yunnan was united by Piluoge, the fourth king of Nanzhao, who was confirmed by the imperial court of the Tang dynasty as king of Yunnan.[24] Ruling from Dali, the thirteen kings of Nanzhao ruled over more than two centuries and played a vital role in the dynamic relationship between the Tang dynasty and the Tibetan Empire as a buffer state.[25]