There was a sage by name Mandavya. He would sit outside his hermitage under a tree and do penance, observing a vow of silence. One day, some thieves came running towards his asylum carrying the loot. Finding the hermitage to be a safe place to hide, they put their loot inside the hermitage and hid themselves there.
The guards chasing the thieves came near the hermitage. Seeing the sage sitting outside the hermitage, they asked him whether he saw the thieves running with the loot. The sage who was in deep meditation did not respond. The guards entered the hermitage and found the thieves hiding there. Suspecting that the sage was protecting the thieves by not informing the guards about the thieves hiding in his hermitage, the guards took him also into custody along with the thieves.
The King sentenced the sage to be executed along with the thieves. The officers carried out the king’s order by impaling him. The sage however, remained alive for a long time by virtue of his ascetic powers. He also, through his powers, summoned other sages to the spot. Other sages visited him at night taking the form of birds. Seeing his condition, they were plunged into grief. They asked him what had happened. The sage replied that he was not offended by anyone other than himself.
Subsequently, the officers of justice who came to that place noticed that the sage was alive. They informed this to the king. The king after consulting his advisers realized that he had made a mistake. He came to the sage and sought his pardon after admitting his mistake. Seeing that the sage was pacified, the king tried to get the stake extracted from his body but could not succeed in his efforts. He then cut off the portion of the stake protruding outside his body.
The sage moved about with a portion of the stake inside his body. He continued to practice the most austere penances. He came to be called Ani-Mandavya (Mandavya with the stake within).
One day, the sage went to the abode of the God of Justice. The sage asked him, “Tell me what sin did I commit to deserve this agonizing punishment?”
The God of Justice replied, “You once pierced a small insect using a blade of grass. Just as a small good deed will grow big based on its value, a sin will also grow big depending on the pain it causes to the affected.”
The sage asked the God of Justice to tell him when this cruel act was committed by him. The God of justice said that this was committed by him when he was a child. The sage pointed out that it had been ordained in the scriptures that any act of a child less than twelve years of age won’t be treated as a sin.
“The punishment you have inflicted on me for such a trivial offense is highly disproportionate to the severity of the offense. You will, therefore, be born among men as a Sudra,“ said the sage.
As a consequence of Mandavya’s curse, the God of Justice was born as Vidura to a Sudra woman.