According to the legends,
Ravana was performing penance in the Himalayan region to appease Shiva. He offered nine of his heads as an offering to Shiva. As he was to sacrifice his tenth head, Shiva appeared before him and expressed satisfaction with the offering. Then, Shiva asked what boon he desired. Ravana asked to take the "Kamna Linga'' to the island of Lanka and expressed his desire to take Shiva from Kailash to Lanka. Shiva agreed to Ravana's request but with a condition. He said that if the lingam was placed en route, it would become the permanent abode of the deity and could never be moved. Celestial gods became worried upon hearing that Shiva had departed from his abode on
Mount Kailash. They sought a resolution from Vishnu. Vishnu asked
Varuna, the deity associated with water, to enter Ravana's stomach through
achamana, a ritual that involves sipping water from the palm of one's hand. As a consequence of performing
achaman, Ravana departed for Lanka with the lingam and felt the need to urinate in the vicinity of Deoghar. The story states that Vishnu took the form of a shepherd named
Baiju Gadariya of
Gadaria caste While Ravana went to perform
Surya Namaskaram, he gave a lingam to this shepherd. Due to the presence of Varun Dev, Ravana took a very long time. Baiju got angry, having to wait for Ravana, for a very long time. He then positioned the lingam on the ground and left the place. Upon returning, Ravana attempted to pick up the lingam, but was unsuccessful in his endeavor. Ravana became upset after realizing this was the doing of Lord Vishnu and proceeded to press his thumb onto the lingam before departing which partially damaged the Shiv Lingam. The Shiva lingam was then worshipped by Brahma, Vishnu, and other deities and they constructed the Baidyanath Temple. Since then, Mahadev has taken up residence in Deoghar as the embodiment of the
Kamna Linga. ==Jyotirlinga==