 Rama wanted to have a large "lingam" to worship Shiva.He directed Hanuman, the lieutenant in his army, to bring a "lingam" from the Himalayas.When Hanuman was delayed in bringing the "lingam", rama built a small lingam out of the sand available in the seashore, which is believed to be the "lingam" in the sanctum.