Once, Andhak brothers jokingly told him that, since his real parents were somebody else (Shiva and Parvati) therefore he was not fit to rule them. Though they had told this in good humour, yet Andhak was very much saddened by their remark. He relinquished his throne and went to a deserted place in the forest and started to do a severe penance. Lord Brahma became very pleased by his penance and appeared before him. He asked him to demand anything he wished to be fulfilled. Andhak said-
“I only long for the love and affection of my brothers. O Lord! Bless me so that nobody should be able to kill one except lord Shiva.”
Lord Brahma blessed him and said- ‘so be it’.
Andhak returned to his kingdom and with the co-operation of his brothers like Prahalad etc he brought even the deities under his control. But drunk with power he became very arrogant and started tormenting all the creatures. He did not show any respect to the Vedas, brahmin and the deities.
Andhak had become so arrogant that once he even dared to dishonor his own mother-Parvati, who at that time was living at the Mandarachal mountain. Shiva became very furious with him.
Andhak attacked Shiva with his huge army. Lord Shiva sent his numerous ganas to fight him, but all of them were killed by Andhak.
When lord Shiva got the news of the arrival of Andhak with his army, he sent Lord Vishnu and his remaining ganas to fight him. He himself went to perform his austerity named ‘Pashupat’. The deities fought with Andhak for one thousand years. Meanwhile Lord Shiva returned after completing his ‘Pashupat Vrata’ and joined them.
Seeing Lord Shiva in front of him, Andhak became furious and attacked him ferociously. His companion, whose name was ‘Vidhas’, devoured all the deities. The demons who had been killed in the battle, were brought back to life by Shukracharya.
Lord Shiva became very angry and swallowed Shukracharya. He also extracted the deities from the stomach of Vidhas who had been swallowed by him earlier. After that, lord Shiva attacked Andhak with his trident, which injured him. But from each drop of his blood which fell on the ground, manifested thousands of demons who resembled Andhak.
Lord Shiva then instructed goddess ‘Chandika’ to drink the blood, while he killed all the demons. Goddess Chandika followed the instructions of Shiva and drank each drop of blood, which oozed out from the wounds of the demons and did not let single drop of blood to fall on the ground.
After killing all the demons, lord Shiva lifted Andhak with his trident and hanged him between the earth and sky. Andhak remained there for a very long period of time, bearing the heat of the sun and the showers of rain. But he remained alive. Ultimately he had to take the refuge of Lord Shiva, to save his life. Lord Shiva became pleased by his eulogy and made him his ‘Ganadhees’ (leader of all the Ganas).
When lord Shiva swallowed up Shukracharya, he became very restless and started to find out a way through which he could come out from Shiva’s stomach. But all of his efforts went in vain. Finding no other option, he started to chant the name of lord Shiva. His chantings continued for one hundred years. By the blessings of Shiva, he came out from Shiva’s stomach through the ejaculated semen.
After coming out, Shukraharya eulogized Lord Shiva. Shiva became pleased with him and showered him with affection just like his own son. After being blessed Shukracharya went and rejoined the army of the demons.