According to Mahabharata, the Kurukshetra war resulted in the death of all the 100 sons of Gandhari. On the night before Duryodhana's death, Lord Krishna visited Gandhari to offer condolences. Gandhari felt that Lord Krishna knowingly did not put an end to the war. In a fit of rage and sorrow Gandhari cursed that Krishna along with everyone else from "Yadu" dynasty would perish after 36 years. Krishna himself knew and wanted this to happen as he felt that Yadavas have become "Adharmi" so he ended Gandhari's speech by saying Thathastu.
Later at a festival fight broke out between Yadavas who killed each other. His elder brother Balaram gave up his body using Yoga. Krishna retired into the forest and started meditating under a tree. The hunter"Jara Sabar" mistook Krishna's partly visible left foot for that of a Deer and shot an arrow wounding and killing him. When Jara realized he wept for the mistake on which Krishna told Jara "O Jara you were Vaali in your previous birth, killed by myself as Rama in Tretaya Yuga. You are reincarnated as hunter in Dwapara Yuga and had a chance to revenge your killing and since all acts are desired by me you need not worry for this.
On hearing this terrible news the five Pandava brothers quickly arrived on the scene. Lord Krishna gave them some good advices and took away heavenly power of Krishnakala from Arjun the best of Archer when Arjun pulled out the arrow from the wounded Lord Krishna. Lord Krishna left his mortarial body. The Pandavas carried the body to the Bay of Bengal and cremated there. The whole body was destroyed except for the heart which remained intact and indestructic. The body was thrown in to the sea.
Jara was watching the scene of obsequies in agony. He followed this unburnt part thrown in to the sea emanating brilliant luster, but finally able to fetch it. He was surprised that unburnt part had turned into blue stone. This blue stone was worshipped by him in a cave secretly and thereafter by his family heads in succession and continued till Sabar chief Viswabasu.
Nilamadhav was worshipped in secrecy and in deep forest. Even "Devatas" used to come at night and worship Lord Nilamadhav.
In the meanwhile Raja Indradyumna (Indradyumna a legendary figure and his historicity cannot be established on any safe frowned). King of Solar dynasty in Satyayuga ruling the city of Avanti an Malaya a great devotee of Lord Vishnu came to know of Nilamadhav and wanted to consecrate the extraordinary deity of Lord Vishnu. He deputed Brahmi Priest Vidyapati who married the daughter of Sabar Chief Stain and marked the route to the cave where Nilamadhav was being worshipped. After locating the route Nilamadhav. The King with his army accompanied by "Narada" marched to the secret spot. Furious King imprisoned "Viswabasu" the tribal chief and began his return disappointed. Crestfallen devotee of Lord Vishnu received a divine message to free the tribal chief and perform Ashwamedha Yagna. Narada assured the king of Lords blessing.
The King went to Nilagiri and performed the Yagnam. Lord Nilamadhav appeared in dream to King Indradyumna and informed Lord will appear in the form of Daru (Log of sacred wood) in the sea.
"I will manifest in the form of a very large fragrant, reddish log and the signs of Shanka, Chakra, Gada, Padma will be seen everywhere on that form. Go and take me out and make four deities and then you will be able to worship me. "On the next day the king got information about the floating of Daru with four branches.
The Daru was brought and placed on 'Mahavedi'. When Narada was discussing about crafting of deities a divine voice announced that the God himself will prepare his own image. While the king was thinking about this an old carpenter (said to be Lord himself in form of Viswakarma) appeared and offered to prepare the idol on condition that the door of the temple should remain shut and no one should enter or disturb for 21 days inside the temple. The king agreed to this condition. After 15 days when no sound of construction of image came from the room, the king and queen being impatient and doubtful opened the door and found the images remains unfinished and the carpenter has disappeared. In the meanwhile a heavenly voice declared "Oh king dress these four deities with silken garments and establish the imaged on "Mahavedi". Accordingly the king worshipped the Lord Jagannath, Balabhadra, Subhadra and Sudarshan uttering three "Suktas of the Rig Veda" which are symbols of Brahman. From that day traditional has associated with worship of deities at Purushottam known with the name of Indradyumna.
Shree Jagannath Mahaprabhu â€“ the Lord of the Universe is the "Patitapabana" the savior and solace of the down trodden, the believer and the dependent. He is the Lord of Universe. A symbol of cosmic energy the highest expression of God. He is the manifestation knowledge, power, majesty, strength, energy and self sufficiency. He is the remover of sin, savior of the fallen soul and giver of salvation. Lord of the masses and Lord of the sufficiency humanity.
Jagannath is worshipped as Narayana (the cosmic sustainer of Universe or Vishnu when on Ratna Vedi in the sanctum sanctorum, as Ganesh (the destroyer of all obstacles) when on Snana Vedi during Snana festival as Rudra an expression of Shiva (the cosmic destroyer of Universe) during Nava kalevara Ceremony, as Durga (the source of all energy in the Sayana festival and as Surya (the synthesis of cosmic trio) when in the chariot during the Car festival.
Lord Jagannath responds to all beyond the barrian of caste, creed, religious faith and race. Jagannath as a form of Vishnu is non sectarian though there are several common aspects with Vaishnavism, Saivism, Shaktism, Smartism, Buddhism and Jainism.
Lord Jagannath is Avatari and not merely an Avatar of Vishnu. The Avatar (incarnation) emanates from him is the cause of all material creation. The Avatars after their cosmic play dissolute (Bilaya) in him (Jagannath). All the Avatars take their births for Lilas in this universe and at the end would merge in the self of Purna Brahma.
Lord Jagannath is Anantha (infinity, has no end) is Alekha (beyond description), Anadi (has no beginning, has life beyond evolution), Anam (without name) Nirguna (without attributes) Niranjan (without Stigma) Nirakara (without form). He is Purna Brahma, Sunya Purusa. He is Jagabandhu, the friend of the Universe.
Shree Jagannath is believed to a form of Vishnu and Lord Srikrishna. (Lord Jagannath is the Avatari i.e cause of Avatars and not merely an Avatar). The Avatars after their cosmic play dissolute (Boliya) in him (Jagannath). Avatars take their birth for Lilas in this universe and would merge in the self of Purna Brahma. Legendary origin of Lord Jagannath is traced to Mahabharat.