Mrikandu rishi and his wife Marudmati worshipped Shiva and sought from him the boon of begetting a son. As a result he was given the choice of either a gifted son, but with a short life on earth or a child of low intelligence but with a long life. Mrikandu rishi chose the former, and was blessed with Markandeya, an exemplary son, destined to die at the age of 8.
Markandeya grew up to be a great devotee of Shiva and on the day of his destined death he continued his worship of Shiva in his aniconic form of Shivalingam. The messengers of Yama, thegod of death were unable to take away his life because of his great devotion and continual worship of Shiva. Yama then came in person to take away Markandeya's life, and sprung his noose around the young sage's neck. 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. For this act, Shiva was thereafter known also as Kalantaka ("Ender of Death").
The Maha Mrityunjaya Stotra is also attributed to Markandeya, and this legend of Shiva conquering death is inscribed in metal and worshipped at Tirukkadavur in Tamilnadu, India.