Mandavya was a sage who was doing penance at his hermitage (ashram) when several thieves ran past being chased by the king’s men. The thieves left the stolen property near Mandavya and ran away. The king’s men found Mandavya with the stolen property and took him before the king. Since he did not answer the questions put to him, Mandavya was condemned to death—along with the thieves, who were finally caught. They were all pierced through with a trident. The thieves died, but Mandavya stayed alive. After some time SHiva appeared before him and granted him long life. The king learned that Mandavya was still alive, made further inquiries, and realized that Mandavya was innocent. He asked Mandavya to forgive him. Mandavya did so, even though it was not possible to take the trident completely out of his body. The tip (ani) of the trident was left. And thenceforth Mandavya came to be known as Ani-Mandavya (Mandavya with the tip).
Ani-Mandavya asked the gods why he had to undergo this punishment, even though he had committed no sin. The god Dharma (Dharma-deva) answered that Mandavya in his childhood used to pierce butterflies on broomsticks. Being pierced with the trident was punishment for that sin. Ani-Mandavya argued that, according to the scriptures, sins done before the age of twelve would not be punished. So Ani-Mandavya laid a curse on Dharma-deva to be reborn as the son of a lower-caste, sudra woman. And so it was; Dharma-deva was born as Vidura, the son of the palace maid and the sage Vyasa. There is another version of this myth in which both cursed each other to be born of sudra mothers in their next rebirth.
As in the Jewish story of Job, Ani-Mandavya, who had been a just man and fulfilled his dharma (duty, righteousness), was betrayed by the divine, personified as Dharma-deva. The story of Ani-Mandavya in the Puranas is but one example of a strong protest against institutionalized duty.