Until the Tibetan Empire's collapse in the 9th century, it was the Tang's major rival in dominating Inner Asia.