The legend begins with the Mahābhārata. Barbarika alias 'KhatuShyam' alias Shyam Baba was a grandson of Bhima, Second of the Pandava brothers. He was the son of Ghatotkacha (who in turn was son of Bhima) and Kamkantkata Ma Morwi . Even in his childhood, Barbarika was a very brave warrior. He learnt the art of warfare from his mother. God Shiva, pleased with him, gave him the three infallible arrows (Teen Baan). Hence, Barbarika came to be known by the appellation Teen Baan Dhaari, the "Bearer of Three Arrows". Later, Agni (the god of Fire) gave him the bow that would make him victorious in the three worlds.
When Barbarika got to know that battle between the Pandavas and the Kauravas had become inevitable, he wanted to witness what was to be the Mahābhārata War. He promised his mother that if he felt the urge to participate in the battle, he would join the side which would be losing. He rode to the field on his Blue Horse equipped with his three arrows and bow.
Krishna disguised as a Brahmin and stopped Barbarika to examine his strength. He baited Barbarika by mocking him for going to the great battle with only three arrows. On this, Barbarika replied that a single arrow was enough to destroy all his opponents in the war, and it would then return to his quiver. He stated that, the first arrow is used to mark all the things that he wants to destroy. On releasing the third arrow, it would destroy all the things that are marked and will then return to his quiver. If he uses the second arrow, then the second arrow will mark all the things that he wants to save. On using the third arrow, it will destroy all the things that are not marked. In other words, with one arrow he can fix all his targets and with the other he can destroy them.