Once, Lord Shiva arrived at Mahakal forest with a skull in his hand. All the trees and vegetation were delighted to find him in their midst. They requested lord Shiva to remain their forever. Lord Shiva told them that it was not possible for him to stay there forever but on being requested once again agreed to stay there for at least a year. After one year, when the time for departure came he released the skull from his hand as a memorial.
When Lord Brahma came to know of this incident, he instructed all the deities to reach Mahakal forest without wasting any time so that a grand yagya could be performed at the place where Shiva had left the skull. All the deities went to the said place and worshipped Lord Shiva by employing the rituals of Pashupat vrata, which Lord Brahma had taught them. Lord Shiva became pleased by their devotion and said– ‘ Perhaps you all are not aware that there was a specific objective behind my act of releasing the skull from my hand. This act of mine was done to protect your lives but it seems you are unaware of its significance. In a way, all of you have already received my blessings in advance for your deep devotion. What else do you wish for?’
Deities were amazed by Shiva’s statements and were wondering what Shiva was trying to convey. So, they requested Shiva to unravel the mystery so that they could understand what he meant to say. Lord Shiva told them- ‘The followers of Maya were planning to kill you while you were busy doing penance but no one of you was aware of their evil motive. I came to know about this in my deep state of meditation and dropped the skull from my hand. As soon as the skull touched the ground a thunderous sound was made as the result of which all the demons were killed instantaneously.’
All the deities thanked Lord Shiva for protecting their lives. In course of time this particular place became famous as Kapal mochan temple and is presently situated in Ujjain.