At one time Ayodhya was ruled by King Ambrish who decided to perform a big sacrifice to which the entire kingdom was invited. Just a day before the occasion, Lord Indra stole the animal to be sacrificed as he feared that King Ambrish would find favour with the gods.
On seeing the sacrificial animal missing, the king became worried as he considered it an ill omen. He called the priests for a solution and they advised him to perform a still bigger sacrifice to please the gods. The priests said, “It would be ideal if a strong and powerful youth is sacrificed to make amends and Your Majesty will need to go and search for one personally.”
The king was worried as to where he could find such a youth who would be willing to be sacrificed. He set out on his journey with a few of his trustworthy men. He searched but none of the parents were willing to sacrifice their son. At last, King Ambrish came to a poor villager’s cottage. The villager had three sons and when the king approached him with his request to be willing to sacrifice a son, the villager replied, “I cannot give my eldest son as he will continue my lineage. My youngest son is the pet of my wife and she will never let him go.”
The king begged and pleaded and promised to give bags full of gold and diamonds to him. At last the middle son said, “Your Majesty, I am willing to be sacrificed provided my parents are given all that you have promised to give in exchange for me. My parents and brothers have been living in abject poverty. We really need the gold and diamonds.”
The king was happy to hear this and after sending one of his men to bring all the gold and diamonds that he possessed, he gave it to the poor man. Taking the middle son along with him the king left for his kingdom. On the way he had to pass through a forest. Here he came across Vishwamitra who was engaged in meditation. For a moment Vishwamitra opened his eyes and he saw a youth with the king. The youth turned out to be his nephew and he asked him where he was going. The youth told him the entire story. On hearing this, Vishwamitra said to the king, “Leave him as he is my favourite nephew. If you want, I am willing to sacrifice one of my sons.” But the sons refused to be sacrificed. Vishwamitra then turned to his nephew and said, “I will teach you two mantras and when you recite them non-stop, no harm shall befall you.”
So Vishwamitra’s nephew reached the kingdom and was tied to a stake while a fire was lighted below his feet. The nephew began to recite the mantras loudly and closed his eyes as he could not bear to see the leaping flames of fire around him. The fire raged and burned, but no harm came to Vishwamitra’s nephew because the mantras that he recited were addressed to Vishnu and Indra, both of whom protected him from harm. He returned alive and came to be known as Devarata.