the city. A second invasion ended disastrously for Pulakesin II, who was forced to retreat to his capital Vatapi which was besieged and Pulakesin II was killed by Narasimhavarman I (630668), son of Mahendravarman I (600630), at the Battle of Vatapi. Under the Pallavas, Kanchipuram flourished as a centre of Hindu and Buddhist learning. King Narasimhavarman II built the city's important Hindu temples, the Kanchi Kailasanathar Temple, the Varadharaja Perumal Temple and the Iravatanesvara Temple. Xuanzang, a Chinese traveller who visited Kanchipuram in 640, recorded that the city was in circumference and that its people were renowned for their bravery, piety, love of justice and veneration for learning. The Medieval Chola king Aditya I conquered the Pallava kingdom, including Kanchipuram, after defeating the Pallava ruler Aparajitavarman (880897) in about 890. Under the Cholas, the city was the headquarters of the northern viceroyalty. The province was renamed Jayamkonda Cholamandalam during the reign of King Raja Raja Chola I (9851014), who constructed the Karchapeswarar Temple and renovated the Kamakshi Amman Temple. His son, Rajendra Chola I (101244) constructed the Yathothkari Perumal Temple. According to the Siddhantasaravali of Trilocana Sivacharya, Rajendra Chola I brought a band of Saivas with him on his return from the Chola expedition to North India and settled them in Kanchipuram. In about 1218, the Pandya king Maravarman Sundara Pandyan (12161238) invaded the Chola country, making deep inroads into the kingdom which was saved by the intervention of the Hoysala king Vira Narasimha II (12201235), who fought on the side of the Chola king Kulothunga Chola III. Inscriptions indicate the presence of a powerful Hoysala garrison in Kanchipuram, which remained in the city until about 1230. Shortly afterwards, Kanchipuram was conquered by the Cholas, from whom Jatavarman Sundara Pandyan I took the city in 1258. The city remained with the Pandyas until 1311 when the Sambuvarayars declared independence, taking advantage of the anarchy caused by Malik Kafur's invasion. After short spells of occupation by Ravivarman Kulasekhara of Venad (Quilon, Kerala) in 13131314 and the Kakatiya ruler Prataparudra II, Kanchipuram was conquered by the Vijayanagara general Kumara Kampana, who defeated the Madurai Sultanate in 1361. The Vijayanagara Empire ruled Kanchipuram from 1361 to 1645. The earliest inscriptions attesting to Vijayanagara rule are those of Kumara Kampanna from 1364 and 1367, which were found in the precincts of the Kailasanathar Temple and Varadharaja Perumal Temple respectively. His inscriptions record the re-institution