Thousands of soldiers died in the Mahabharata war, and Shakuni felt responsible. Full of guilt, he went far from Kurukshetra, to Kerala, and prayed to Lord Shiva. When Shiva appeared and offered him a boon, Shakuni asked for moksha for all the soldiers who had died, and nothing for himself. The wish was granted.
The villagers believe Shakuni became a rishi after taking sanyas, which is why Shiva appeared to him. They built a temple on the spot, now called Pavitreswaram, where prayers are still held.

