There is nothing in Taoist history comparable to Ashoka's Buddhist empire or the Christian or Islamic conquests, but Taoist religious groups have been engaged in the internal politics of China in a variety of ways throughout its history. Taoism has often been characterized in the west as a counter-tradition that opposed the government, based on the anti-Confucian content of the Taode jing and Zhuangzi, the utopian visions of the Way of the Celestial Masters of a new Taoist government that would lead the people in a new era of Great Peace,and the biographies of literati Taoist poets and painters who expressed disillusionment with government and nostalgia for village life.
While there is some truth to this association, it is also true that on many occasions, Taoist or Buddhist organizations were allied with a government, their leaders serving as advisors to rulers. These rulers used their connections with religious leaders to solidify their power and lend authority to their reigns. At times Taoist groups supported governments, which in turn sponsored Taoism as an official religion.
Early in the history of Way of the Celestial Masters, there was an alliance with the Wei dynasty (220-265 C.E.) government, which led to the diminishing of the sect's power as that government collapsed. The influence of Way of the Celestial Masters later began to revive as the Jin dynasty (265-420) weakened. Two hundred thousand members returned to the south, where they briefly established another Taoist theocracy in Chengdu, from 302-347.
In northern China, a Celestial Master named Kou Qianzhi (365-448) persuaded the emperor of the Turkish Wei dynasty (386-534) to make Taoism the official religion, and a Taoist altar was built in the capital. The emperor was invested as the Perfect Sovereign of the Great Peace. Eventually the emperor even outlawed Buddhism in support of Taoism, but the dominance of Taoism lasted only a short time after the death of Kou. Nevertheless, until 574 all emperors were confirmed in their mandate by Taoist authority.
In the following centuries, Buddhists and Taoists occasionally tried to abolish one another, but any success was brief. Emperor Wu (r. 560-578) of the Liang favored Buddhism, but he was also a personal friend of Shangqing scholar Tao Hongjing, who prepared alchemical elixirs for him. Tao Hongjing's personal hermitage was thus protected from attacks against Taoism in 504 and 517. Others from the movement fled to the north, which resulted, ironically, in the spread of Shangqing throughout China.
A number of Chinese emperors tried to control both Taoism and Buddhism. For example, in 574 Emperor Wu of the Zhou dynasty (r. 560-578), who had been a supporter of Taoism, ordered all Taoist and Buddhist monks to return to lay life and confiscated all temple lands. He then built one central Taoist temple in the capital instead. After his death, things soon returned to the way they had been prior to his intervention.
A notable example of an alliance between Taoism and the government occurred as the Tang dynasty (618-907) began. The founder of the Tang, Li Yuan, claimed to be descended from Laozi, and cast himself in the role of the Perfect Lord described in Shangqing scriptures, one who would establish an era of Great Peace.
Some Tang emperors favored Buddhism, and Buddhism also flourished in the Tang, but even the Buddhist ruler Wu Zhao (r. 684-705) employed Taoist symbolism and ritual to buttress her rule. The greatest supporter of Taoism during the Tang was the emperor Xuanzong (r. 712-756). An initiate of the Shangqing Taoist tradition, he sponsored Taoist rituals on behalf of the state, and also introduced the Taode jing into the examination system through which government officials were chosen, even writing a commentary on the text.
Halfway through his reign, Xuanzong had a dream visitation from his ancestor, Laozi, who revealed to him the location of a secret talisman. Thereafter the emperor distributed images of Laozi and established institutes for Taoist study in every prefecture in China. Graduates of these schools could participate in new examinations on Taoism that were administered in the capital and gain official appointments if successful in the examinations. Up until this time, examinations and appointments had been based solely on the classical Confucian tradition. This new system lasted only until Xuanzong was overthrown by the rebel An Lushan.
Rulers of the dynasty following the Tang, the Song (960-1279), cast themselves as descendants of another Taoist deity, Zhao Xuanlang. They also appealed to Taoist warrior deities to protect them in battle, and built a temple complex in honor of Zhenwu, the Perfected Warrior. The emperor Huizong (r. 1101-1125) claimed the identity of a Taoist deity himself, and initiated Taoist rites to celebrate his reign. He even commanded that all Buddhists be demoted to lower ranks within the Taoist hierarchy.