Several years earlier, there lived a wise and steadfast sage named Mandavya. While engrossed in meditation, he would not notice what was happening around him—so intense was his concentration.
One day, some bandits who were being pursued by royal soldiers happened to arrive at Sage Mandavya's ashram. Seeing the sage deep in meditation, they felt his hut was the best place to hide their loot, so they quickly stashed it there before fleeing. Soon after, the soldiers reached the ashram and asked the sage if he had seen the bandits. He did not answer and continued meditating in silence. The soldiers then searched inside the sage's hut, where they found the stolen goods. Assuming that the sage was in cahoots with the bandits, they arrested Mandavya.
The soldiers presented Mandavya before the king. The sage protested his innocence, but the king did not believe him and ordered that he be impaled on a stake. The sage survived because of his spiritual power. The king realized that he had made a terrible mistake. He had the stake removed from the sage's body and begged for forgiveness. But the sage wasn't angry at the king.
Instead, Mandavya traveled to Yamaloka and asked Yamaraja, the God of Justice, what he had done to deserve such a punishment. "When you were very young, you had pierced an insect with a blade of grass. This is why you were punished," replied Yamaraja.
"This punishment is disproportionate for a mistake committed when I was an innocent boy," Mandavya said angrily to Yamaraja. "I hereby curse you to be born on Earth as the son of a Shudra woman."
As a result, Yamaraja was born as Ambika's maidservant's son, Vidura. Blessed with worldly wisdom, Vidura would one day become prime minister of Hastinapura and deal in matters of justice.