from Pandya control. During the rule of Dantivarman (r. 796–847 CE), the Pallava territory was reduced by the encroachment from the Pandyas from the south (and Rashtrakutas and the Telugu-Cholas from north). Pallava king Nandivarman III (r. 846–69 CE) was able to defeat the Pandyas and Telugu-Cholas (and even the Rashtrakutas) with the help of the Gangas and the emerging Cholas. Under Chola influence (10th–13th centuries) While the Pandyas and the Rashtrakutas were busy engaging the Pallavas, with the Gangas and the Simhalas (Sri Lanka) also in the mix, the Cholas emerged from the Kaveri delta and took on the chieftains of Thanjavur (the Mutharaiyar chieftain had transferred their loyalty from the Pallava to the Pandya). The Chola king Vijayalaya conquered Thanjavur by defeating the Mutharaiyar chieftain around . The Pandya control north of the Kaveri river was severely weakened by this move (and straightened the position of the Pallava ruler Nripatunga). Pandya ruler Varaguna-varman II (r. c. 862–880 CE) responded by marching into the Chola country and facing a formidable alliance of Pallava prince Aparajita, the Chola king Aditya I and the Ganga king Prithvipati I. The Pandya king suffered a crushing defeat () in a battle fought near Kumbakonam. By , Chola king Aditya I was the master of the old Pallava, Ganga and Kongu countries. It is a possibility that Aditya I conquered the Kongu country from the Pandya king Parantaka Viranarayana (r. 880–900 CE). Parantaka I, successor to Aditya, invaded the Pandya territories in 910 CE and captured Madurai from king Maravarman Rajasimha II (hence the title "Madurai Konda"). Rajasimha II received help from the Sri Lankan king Kassapa V, still got defeated by Parantaka I in the battle of Vellur, and fled to Sri Lanka. Rajasimha then found refuge in the Chera country, leaving even his royal insignia in Sri Lanka, the home of his mother. The Cholas were defeated by a Rashtrakuta-lead confederacy in the battle of Takkolam in 949 CE. By mid-950s, the Chola kingdom had shrunk to the size of a small principality (its vassals in the extreme south had proclaimed their independence). It is a possibility that Pandya ruler Vira Pandya defeated Chola king Gandaraditya and claimed independence. Chola ruler Sundara Parantaka II (r. 957–73) responded by defeating Vira Pandya I in two battles (and Chola prince Aditya II killed Vira Pandya on the second occasion). The Pandyas were assisted by