 In 779 Tengri Bögü, adviced by Sogdian courtiers, planned to invade Tang China, but was killed by his uncle Tun Bagha Tarkhan, who opposed this plan and ascended the throne.During his reign Manichaeism was suppressed, but his successors restored it as the official religion.In 790 the Uyghurs and Tang forces were defeated by the Tibetans at Ting Prefecture (Beshbalik).