Mrikandu rishi and his wife Marudmati worshipped Shiva and sought from him the boon of begetting a son.
Mrikandu rishi chose the former, and was blessed with Markandeya, an exemplary son, destined to die at the age of 16.
The messengers of Yama, the god of death were unable to take away his life because of his great devotion and continual worship of Shiva.
By accident of fate the noose mistakenly landed around the Shivalingam, and out of it, Shiva emerged in all his fury attacking Yama for his act of aggression.
After defeating Yama in battle to the point of death, Shiva then revived him, under the condition that the devout youth would live forever.