After the death of Kansa his widowed queens Asti and Prapti returned to their father Jarasandh’s home and informed him that Krishna and Balarama had killed their husband Kansa. Infuriated by the news, Jarasandh at once launched a massive attack on Mathura. The people of Mathura were frightened by the strength of Jarasandh’s army. Lord Krishna too fell in deep thought. Just then, divine weapons and chariots appeared from the heaven. Both the brothers took the weapons and boarded their chariots. Then they fought a fierce battle and slayed all the army of Jarasandh.
Balarama furiously caught Jarasandh and was about to kill him. But Lord Krishna stopped him. They then released Jarasandh and let him go unhurt. Jarasandh felt ashamed that Krishna released him because of his helpless condition.
Shukdev says: O Parikshit, despite his shameful defeat, Jarasandh attacked Mathura seventeen times with huge armies. But every time, the Lord defeated him and released him in kindness. And every time Jarasandh felt more humiliated.”
At last, instead of attacking Mathura himself, Jarasandh sent Kalyavan to defeat Sri Krishna. Kalyavan launched an attack on Mathura with one crore strong Malechchh army. This time Lord Krishna decided to vacate Mathura instead of countering the attack.
He got Dwarikapuri constructed by Vishvakarma and settled all the people of Mathura there. Then, unarmed, Lord Krishna walked past Kalyavan. Pointed by Narada, Kalyavan at once recognised Krishna and gave Him a chase. He also challenged Him, but the Lord did not listen to his challenges and kept moving with face turned away. Kalyavan chased Him for long, but could not catch up.
Ultimately the Lord entered a cave. Kalyavan too followed Him into the cave. In the cave the Lord saw that someone was sleeping there. So He covered the man with his yellow length of cloth and himself hid inside the cave. Kalyavan too arrived there and saw the sleeping man. He mistook him for God and said: “Krishna, you might have thought that braves do not attack on sleeping people. So I will first wake you up and then kill you.” Saying thus Kalyavan kicked the sleeping man hard. However, as soon as the man awakened and glanced at Kalyavan, Kalyavan got incinerated at once.