Mandavya

Mandavya (माण्डव्य), also called Aṇi Māṇḍavya, is a sage in Hinduism. He is best known for a legend where he is wrongfully punished by a king by impalement.

Impalement
According to the Mahabharata, Mandavya was once performing a tapas with his arms raised, standing in front of his ashrama for many years. During this period, some thieves happened to pass by his ashrama, having stolen property belonging to the king. Finding that the king’s men were pursuing them, the thieves fled, after leaving their stolen property in the sage's ashrama. The king’s men seized Mandavya, believing him to be an accomplice. Mandavya refused to talk to his accusers. When the thieves were caught, Mandavya also along produced before the king, and they were all condemned to death. The thieves and the sage were struck at the tip of a trident, and while the thieves died, Mandavya stayed alive.

According to the Brahmanda Purana, even as the sage underwent this suffering, Ugrashravas, the husband of Shilavati, wished to visit the house of his favourite prostitute, and Shilavati agreed to carry him to her house. When the couple came across Mandavya, the latter understood the man's intentions, and cursed him to die before the next sunrise. Horrified, Shilavati, with her piety, ensured that Surya, the sun god, would not rise the next dawn. Since this led to universal chaos, the devas approached Anasuya, who convinced Shilavati to have the sun rise again.

Shiva blessed the sage with longevity, and several sages appeared before Mandavya, making enquiries regarding him. When the king realised that Mandavya was innocent, he rushed to seek the sage's forgiveness. His men tried to pull the trident from his body, but were unable to do so. Finally, the sage had to be released by cutting the trident, with its tip (Aṇi) remaining in his form. Hence, he came to be known as Aṇi Mandavya.

Cursing Dharma
Mandavya approached Dharma (Sometimes identified with Yama), asking why an innocent man like him had suffered the hardship that he had gone through. Dharma answered by stating that Mandavya had tortured small birds when he was a boy, and his impalement had been the punishment. The sage countered that the Shashtras stated that no man should have to suffer for any sin committed before the age of twelve, arguing that he had been unjustly punished. Since Dharma had attempted to murder him, a Brahmin, the greatest of sins, he cursed the deity to be born as a Shudra on earth. Accordingly, Dharma incarnated himself as Vidura in the Mahabharata.