안사의 난
Tang dynasty became greatly weakened due to the An Lushan Rebellion and in 755, the Chinese were forced to pull back their soldiers from the region. The area was first taken by the Tibetans, then finally by the Uyghurs in 803, who called the area Kocho (Qocho).