As per the ancient literatures and as contained in Shrimad Bhagwat and other religious books, there was once a 'Prajapati' named Tvashta, who had a devout and pious son named Vishwarupa. Vishwarupa, blessed with three heads, was a sage having immense spiritual strengths, which evoked a sense of insecurity and fear in the mind of Lord Indra, the king of the Inderlok (Paradise) and in a fit of rage Indra killed the good sage. When Prajapati Tvashta came to know of the incident, he became furious and performed a Yagya with the purpose of avenging the death of his dear son. From the holy fire was born another son of Tvashta, whom he named as Vritrasura and whose sole aim in life was to avenge his brother's death by destroying Indra.
Vritrasura then meditated and undertook a penance as the result of which he was granted a supreme boon. As per this boon no weapon known till then, could kill him, and he would not even die of anything that was either wet or dry or any weapon made of wood or metal. The boon also ensured that his power would go on increasing during the battle. Upon being granted this boon, Vritra waged a battle against Indra and his forces and managed to give a crushing defeat to him as a result of which Indra had to flee from the battle scene leaving behind his elephant Airawat. Vritrasura then took over Inderlok, forcing Indra to flee to Lord Shankar for help. Shankar along with Brahma went to lord Vishnu to seek his help. Vishnu advised them that they should first win the confidence of Vritrasura, befriend him and then kill him when he may not be on his guards. Vishnu also advised them that they should pray to the Goddess so that through her 'Yogmaya' she may render Vritrasura incapable of intelligent thought. Indra did as advised and was consequently blessed by the Goddess.
After this Indra managed to befriend Vritrasura and once when Vritrasura was asleep on sea shore, Indra collected sea-foam as it was neither wet nor dry, neither wood nor any metal and it certainly could not be categorized as a weapon. With the intention of using the sea foam as a weapon to kill Vritrasura, Indra summoned the Goddess to enter the foam. When the Goddess entered the foam, Indra wrapped it around his Vajra (a deadly fierce and favourite weapon of lord Indra, made out of the bones donated by Dadhichi ' Rishi') and with this Vajra he killed Vritrasura there and then. The Devtas, rid of the menace of Vritrasura, praised the Goddess for keeping her promise of helping them in their hour of need.