 The founding of the Tang dynasty (618–907) was accompanied by millenarian prophecies about the advent of a sage-emperor surnamed Li (Bokenkamp 1994). As we saw before  (§2.5),  this was also the surname of the Han-dynasty messiah; four centuries later, the powerful Li clan claimed to belong to Laozi’s lineage, and its rise to the throne was supported by representatives of the Shangqing lineage. The Shangqing patriarch Wang Yuanzhi (528–635) predicted the rise of the Tang, informed Li Yuan that he would become the next emperor, and secretly transmitted to him the “registers” of the Celestial Mandate (tianming). Li Yuan—the future Emperor Gaozu—finally founded the Tang dynasty. These events marked the beginning of the ascent of Shangqing to a status similar to “state religion”, which it maintained throughout the first half of the dynasty (Barrett 1996; Kohn and Kirkland 2000). The support of the court culminated in ca. 740 with the compilation of the Kaiyuan daozang (Daoist Canon of the Kaiyuan Reign Period), the first of a series of imperially-sponsored collections of Daoist texts.