In the second century AD, the Eastern Han dynasty gradually weakened. Outsiders from the Ba region attacked the Hanzhong area, as they had in the past. The Han dynasty lost power. Zhang Lu, supported by followers of a Taoist sect, Way of the Celestial Masters, led an independent theocratic government in Hanzhong. Thirty years later, after the Battle of Yangping, Zhang Lu surrendered Zanghong to the warlord, Cao Cao.