 In 762 Tengri Bögü planned to invade the Tang with 4,000 soldiers, but after negotiations switched sides, and assisted them in defeating the An Lushan rebels at Luoyang.For their aid, the Tang was forced to pay 100,000 pieces of silk to get the Uyghurs to leave.During the campaign Khagan Tengri Bögü encountered Persian Manichaean priests, and converted Manichaeism, adopting it as the official religion of the Uyghur Khaganate.