According to legend, the tooth was taken from the Buddha as he lay on his funeral pyre. It was smuggled to Sri Lanka in 313 AD, hidden in the hair of Princess Hemamali who fled the Hindu armies besieging her father's kingdom in India. It immediately became an object of great reverence and was enshrined in a series of nested jeweled reliquaries. The tooth was brought out for special occasions and paraded on the backs of elephants, which are sacred to the Buddha. where it survived numerous attempts to capture and destroy it. When the capital was moved to Kandy, the tooth was taken to the new city and placed in temples built to honor it. The temple was originally built under Kandyan kings between 1687 and 1707, but later severely damaged during the 18th-century colonial wars against the Portugese and Dutch. After the wars, the original wooden structures were restored in stone. In January 1998 Hindu Tamil separatists bombed the temple, damaging its facade and roof. Restoration began immediately afterward.