It had been foretold that the eighth son of Devaki would kill the evil king Kansa. Upon hearing this prophesies, Kansa had his sister put into prison. He killed her seven children one by one but when Krishna was born, there was divine intervention to save the life of baby Krishna. The guards had fallen into deep slumber and were unable to inform their master about the newborn child.
An heavenly voice commanded Vasudev to take the baby to Gokul and exchange with the newborn baby of Nanda and Yashoda. The shackles and the prison gates opened miraculously and Vasudev carried the child in a small basket, through the waters of Yamuna. As it was a dark stormy night, the waters of
Yamuna were raging but parted to let the carrier of the divine Krishna pass. A huge snake known as Adisesha with 2000 hoods, glided behind them, its hoods formed a protective canopy over the child.
When Vasudev returned back with Nanda's child the shackles fastened and the doors closed and the guards awakened. Kansa came and picked up the child to hurl it to the wall and kill him but somehow the baby slipped from his grasp and took the form of a Goddess laughing at Kansa, she vanished after telling him that the one who would kill him had already taken birth and was elsewhere. This Goddess was Yogmaya.