Historical records suggest that Kandy was first established by the King Wickramabahu (1357-1374 CE) near the Watapuluwa area, north of the present city, and named Senkadagalapura at the time, although some scholars suggest the name Katubulu Nuwara may also have been used. The origin of the more popular name for the city, Senkadagala, could have been from a number of sources. These include naming after a brahmin named Senkanda who lived in a cave near the city, after a queen of King Wickramabahu named Senkanda or after a colored stone named Senkadagala. The present name Kandy, an anglicized version of Kanda Uda Rata ("the land of mountains") originated in the colonial era.
In 1592 Kandy became the capital city of the last remaining independent kingdom in Sri Lanka after the coastal regions had been conquered by the Portuguese. Invasions by the Portuguese and the Dutch (16th, 17th and 18th century) and also by the British (most notably in 1803) were repelled. The last ruling dynasty of Kandy were the Nayaks of Kandy. Kandy preserved its independence until it finally fell to the British in 1815. The British deposed the king, Sri Wikrama Rajasingha, and all claimants to the throne, thus ending the last traditional monarchy of Sri Lanka, and replaced it with their monarchy.
View of the lake from Rajapihilla Mawatha, on the right the golden roof of the Temple of the Tooth, top left a Toque MacaqueAs the capital, Kandy had become home to the relic of the tooth of the Buddha which symbolises a 4th-century tradition that used to be linked to royalty since the protector of the relic was seen fit to rule the land. Thus, the Royal Palace and the Temple of the Tooth were associated with the administrative and religious functions of the capital city. Even after its conquest by the British, Kandy has preserved its function as the religious capital of the Sinhalese and a place of pilgrimage for Buddhists, namely those belonging to the Theravada school.
Portuguese invasions in the 16th century and 17th century were entirely unsuccessful. The kingdom tolerated a Dutch presence on the coast until 1761, when Kirti Sri attacked and overran most of the coast, leaving only the heavily fortified Negombo intact. When a Dutch retaliatory force returned to the island in 1763, Sri abandoned the coastline and withdrew into the interior. When the Dutch continued to the jungles the next year, they were constantly harassed by disease, heat, lack of provisions, and Kandyan sharpshooters, who hid in the jungle and inflicted heavy losses on the Dutch. The Dutch launched a better adapted force in January of 1765, replacing their troops' bayonets with machetes and using more practical uniforms and tactics suited to speedy movement. They were initially successful, capturing the capital, but they took a deserted city, and the Kandyans withdrew to the jungles once more, refusing to engage in open battle. The Dutch, worn down by constant attrition, came to terms in 1766.