Mrikand Muni, Markandeya’s father performed tremendous austerities to get a son from Shiva. After some time Lord Shiva appeared to him and asked him what boon he wanted. Mrikand Muni told Shiva that he wanted a son. Shiva said to him, “You can have a foolish son with a long life or you can have a very intelligent son; but he will die at an early age.” Mrikand Muni said, “I’ll take the intelligent son.” Markandeya was born as the son to Mrikand Muni and Mrikand Muni was very happy.
Markandeya grew up as a lover of Shiva. His father gave him a lot of knowledge and taught him how to do tapasya. When his son reached 16 years of age, Mrikand Muni became despondent because he knew that his son would die early. He decided that he would not live in the world without his son and he tried to take his own life. Just then Narad Muni appeared and asked Mrikand Muni why he was trying take his own life. Mrikand Muni explained that he was very sad that his son would die soon. When Markandeya overheard this, he said to his father, “This body is nothing but the five elements and it is not eternal. Why are you sad even though you have so much knowledge? Mrikand Muni replied, I am sad because I will not be able to see you any more.”
Hearing this conversation Narad Muni advised Markandeya, “You perform austerities for Shiva and Shiva will give you blessings. Shiva brought you here and Shiva will take you from here.”
So Markandeya went off to do tapasya. He began to worship Shiva everyday, 24 hours a day. He recited the Mahamritunjaya Mantra, the Mantra which gives victory over death. At the appointed time for Markandeya to die, Yama, the God of Death, came to take Markandeya, but Markandeya was completely absorbed in samadhi.
Then Shiva appeared and said to the God of Death, You cannot take him because he is praying to me with pure devotion. He is totally surrendered in worship. Whoever attains that quality of attention is freed from death.”
Yama replied, But it is my duty to take him. What shall I do? Shiva said, No. You cannot take him. He will come with me.
At this time the Divine Mother appeared. She said to Yama, You cannot take him. He has other karma to perform. I will give him a boon. She told Markandeya, You will write about me and share that knowledge with all of humanity so they will understand how they can be united with me. When they will know me, they will try be with me all of the time.
So Markandeya was saved and he went off to do tapasya and realized the Divine Mother. After his realization he wrote the Chandi Path.