Yudhishthira, the ruler of the Pandava people, had fought many years against evil forces, and after vanquishing them all, sought to enter the realm of Immortality. He set out for Mount Meru, planning to travel to Celestial City from there. Yudhishthira was accompanied by his four brothers and his wife, Draupadi. Soon after they set out, the pilgrims were joined by a dog, which followed behind, quietly.
The pilgrimage proved arduous. Yudhishthira's brothers began dying, one after another. Soon thereafter, loyal Draupadi too succumbed to death. Yudhishthira, alone except for the dog, finally reached Celestial City. Lord Indra, the king of the gods, was there to receive him. But Yudhishthira was not quite ready.
"Without my faithful brothers and wife, I do not wish to enter Heaven," he said. Indra replied, "Fear not. They are already here, and are eagerly awaiting your arrival." Hearing this, Yudhishthira said, "I am glad to hear it. But I have one more request to make. Please admit this dog into heaven as well. It is devoted to me, and my heart is full of love for it."
Indra tried to dissuade him. "One must be pure in order to enter Heaven. Even touching the dog will take away all your merits. Therefore, I advise you to abandon it. It is no sin, anyway!"
"I cannot do that," said Yudhishthira resolutely. "I have always cherished this vow: never to desert one that is frightened and seeks my protection, one that is afflicted and destitute, or one that is too weak to protect himself and desires to live. I also cannot abandon one who is faithful to me."
Saying so, he turned away from Heaven's gate. Seeing the dog, Yudhishthira stretched out his hand to pat it. At that point, an amazing thing happened. The faithful dog changed into Dharma, the Lord of Righteousness and Justice.
Indra said, "Yudhishthira, you are a good man. You have shown boundless love towards all creatures. You renounced the highest happiness for this humble dog. For your faithfulness and compassion, you will certainly be honoured in Heaven."
Thus, Yudhishthira entered the Celestial City, with Dharma by his side. There, he was reunited with his brothers and wife, and lived blissfully ever after.