King Janamejaya the son of King Parikshit was the king of the Kurus, ruling from Hastinapura. One day, a Brahmana named Utanka (whose story is narrated here), came to his court. The king received him graciously, and asked him if there was something he could do for him.
Utanka said, "You amaze me King Janamejaya. When the murderer of your father is roaming around free, you sit at ease in your court and enjoy the the comforts of a King. You have acquired fame as a just King, but I see no evidence of it. You have not even addressed this great injustice to your father!" not addressed this great injustice done to you."
Janamejaya was surprised. He turned to his counsellors and sad, "What is this about my father's murder. I was but a child when he passed away, I no naught of the circumstances behind his death. I would like to know if he was killed unjustly, and if so, who the culprit is."
The courtiers said, "Your father Parikshit ruled the kingdom after the Pandavas and ruled for a long time truthfully. He was popular among his subjects and was a terror to his enemies. He was killed by Takshaka, the king of the serpents, pursuant to a curse by the son of a Rishi(sage). (You can read that story here.) What Utanka has said is true, Takshaka, the murderer of your father still roams free.
When Janamejaya heard these words, he was rendered speechless for a while due to anger. Once he regained control over himself he said to Utanka, "O Brahmana, I thank you. You have brought this great injustice to my attention. I must revenge myself on this arrogant Takshaka at once. Tell me, what is the means by which I might accomplish this task?"
Utanka replied, "Takshaka is the friend of Indra. Under Indra's protection, he feels safe from retribution, so his conceit has grown boundless. However, there is a great sacrifice mentioned in the Puranas. It is the snake-sacrifice. When this sacrifice is conducted, the snakes that are named by the Mantras (incantations) will be rendered powerless and be impelled to fall into the sacrificial fire. Make arrangements to conduct this sacrifice. I shall assist you, for Takshaka has caused trouble for me also. He once stole the ear-rings that I was taking for my Guru Veda's wife. I had to face many difficulties in recovering them. So both our wishes may be accomplished by this sacrifice."
King Janamejaya then made arrangements for this sacrifice. He invited the greatest sages and priests to conduct this sacrifice. This was a truly great undertaking, for the rituals for this sacrifice were arduous, and had to be exactly followed, if the sacrifice was to bear foot. A suitable spot was chosen and the great sacrificial hall was constructed. A platform was raised in its midst and was decked with valuable articles. This was were the Brahmanas were to sit. The Ritwika (officiating priest) sat in its middle. The king also underwent the rituals that will purify him to participate in the sacrifice.
While these preparations were on, a Shudra named Lohitaksha, who was well versed in the art of sacrificial construction, examined the measurements of the hall, the type of soil on which its foundation had been laid, and said, "O King, I perceive from these signs that your sacrifice will not be completed. The omens portend that this sacrifice shall be stopped due to the intervention of a Brahmana."
This made King Janamejaya recall an incident where his brothers had beaten a small dog for fun in times gone by. The mother of that puppy, a divine bitch named Sarama, came to Janamejaya and asked him, "What was the crime committed by my son that you had him beaten? Did he lick the sacrificial offerings? Did he try to steal the sacrificial butter? Why did your brothers beat him?". The King knew that his brothers had done it merely for sport, so he hung his head in shame. Then the dog Sarama had cursed him saying, "Since your brothers have tortured my faultless pup, may the greatest undertaking that you begin, remain incomplete!".
The King recalled this curse and became very worried when he was told by the expert builder that this sacrifice would be incomplete. He then gave orders to his guards that no one was let into the sacrificial hall without his permission.
The great sacrifice began. The officiating priests were clad in black, for this was a Yagna directed towards destruction. As they chanted the appropriate Mantras and poured the clarified butter into the fire, snakes, impelled by the power of these incantations, started converging from all over the world. There were snakes of all shapes and sizes, some of them were as large as buildings, some as small as insects. As the priests called each snake by name and uttered the fatal words, "may so and so fall into fire", that snake would meet its fiery end into the sacrificial fire.
Many great Brahmanas were involved in the conduct of this sacrifice. A great Rishi named Chandabhargava, who was a descendant of Chyavana was the Hotri (I believe it is the Hotri who pours out the sacrificial oblations into the fire). A learned old Brahmana named Kautsa was the Udgatri (chanter of vedic hymns). A sage named Jaimini acted as the Brahmana (I believe this is the master of the sacrifice) and Sarngarva and Pingala were the Adhvaryus (no idea what this means). Vyasa was present with many of his disciples, and was generally supervising the conduct of the sacrifice. His students were chanting the name of the Lord. Many other great Brahmanas were present to observe the conduct of this magnificent sacrifice.
The sacrifice continued for days. Snakes were perishing in the flames in thousands. At this point, a Brahmana named Astika came to visit the sacrifice. The sacrifice was nearing completion. The King welcomed his guest and said, "O Brahmana, despite your relative youth, your very being is radiating with knowledge. I have sworn to grant whatever a Brahmana desires. Ask what you will."
At this time, the chief priest intervened and said, "O King, the sacrifice is not yet complete. Takshaka, whose destruction you desired, is still alive. Wait till he is falling to the fire, before you begin giving gifts to Brahmanas."
Janamejaya said, "Why is it that Takshaka is still alive? Invoke the Mantra with his name and make him fall into the fire."
The priests uttered the appropriate incantations, but nothing happened. They then looked at the omens in the air, and used their spiritual power to divine the cause. Finally, the head priest said, "O King, Takshaka has sought asylum from Indra. The Lord of the Devas is protecting him in his palace, that is why our Mantras have not worked."
The king said, "Then utter the Mantra in such a way that Takshaka may be impelled to fall into this fire, even though Indra has given him sanctuary."
The chief priest then invoked a powerful Mantra and said, "May Takshaka fall into this fire, accompanied by Indra."
Such was the potency of the invocation, that both Indra and Takshaka started falling into the sacrificial fire, bound to each other. When Indra saw that his friend's fate was inevitable, he let go of Takshaka and decided to save himself. Takshaka then started falling alone into the fire.
At this moment, Astika said, "STAY! Takshaka may your fall be arrested!". He then turned to the King and said, "This is the boon that I seek of you. May you stop the sacrifice at this time. You have already killed millions of snakes in revenge for your father's death. I am a Brahmana, but my mother Jaratkaru, is the sister of Vasuki, the foremost of the serpents. She sent me here to stop your sacrifice and to save her kinsmen. Even Lord Brahma desires that you should remain content with slaying so many evil snakes. The snakes that are left still (excluding of course, this vain Takshaka), are virtuous and not deserving to be destroyed. Your glory will only increase if spare their lives."
King Janamejaya demurred. At this point Vyasa spoke to him, and advised him to grant Astika's request. Thus advised by the sage for whom he had so much respect, the King gave orders for the sacrifice to end.
The King then bestowed great riches upon Astika and all the priests who had conducted the sacrifice. He gave special honor and a great amount of wealth to Lohitaksha, the master builder who had foretold that the sacrifice would be stopped by a Brahmana.
This is the story of the great snake sacrifice conducted by King Janamejaya. The tradition is that whoever hears this story will have nothing to fear from snakes.