The inscriptions from the Kayarohanswami temple indicate the construction was initiated during the reign of the Pallava king, Narasimha Pallava II (691 – 729 CE). A Buddhist pagoda was built under Chinese influence by the Pallava king and town was frequented by Buddhist travellers. Thirumangai Azhwar, the 9th century vaishnavite saint poet, is believed to have stolen the golden Buddha statue to fund the Ranganthaswamy Temple at Srirangam; the authenticity of the theory is questionable. In the 11th century CE, Chudamani Vihara, a Buddhist monastery was built by Javanese king Sri Vijaya Soolamanivarman with the patronage of Raja Raja Chola. Nagapattinam was the prominent port of Cholas for trade and conquering gateway to the east. In the early 16th century the Portuguese made commercial contacts with the town and established a commercial centre in 1554 CE. The Portuguese also conducted missionary enterprise in the town. In 1658, the Dutch established an agreement with King Vijaya Nayakkar of Thanjavur on 5 January 1662. Ten villages were transferred from the Portuguese to the Dutch – Nagappattinam Port, Puthur, Muttam, Poruvalancheri, Anthanappettai, Karureppankadu, AzhingiMangalam, Sangamangalam, Thiruthinamangalam, Manjakollai, Nariyankudi. Ten Christian churches and a hospital were built by the Dutch. They also released coins with the name Nagappattinam engraved in Tamil letters. Under an agreement between the first Maratta King Egoji of Thanjavur and the Dutch, Naagappattinam and surrounding villages were handed over to the Dutch on 30 December 1676. In 1690, the capital of Dutch Coromandel moved from Pulicat to Nagapattinam. This town fell into the hands of the British in 1781 after the two naval battles between British and French fleets were fought off the coast of Negapatam, as it was then known: the first in 1758 as part of the Seven Years' War and the second in 1782 as part of the American Revolutionary War. The town was taken by the British from the Dutch in 1781 (who had been formally brought into the war in 1780). When the Dutch and British reached a peace agreement in 1784, Nagapattinam was formally ceded to the British. 277 villages, with Nagore as the headquarters, were handed over to the East India Company.