Shunahshepa

The king postponed the sacrifice multiple times citing various reasons, but finally agreed to it when Rohita became an adult.

Rohita occasionally visited his ill father, but on advice of Indra, always refused to accept being sacrificed.

[1] In the sixth year of wandering in the forest, Rohita met a destitute, starving brahmin named Ajigarta Sauyavasi with three sons, who was a descendant of Angiras.

[1][2] Varuna agreed to the replacement on the basis that a brahmin was an acceptable (higher caste) substitute for a kshatriya.

Four priests were called to conduct the sacrifice: Ayasya (the udgatr), Jamadagni (the adhvaryu), Vashistha (the brahman), and Vishvamitra (the hotar).

With his last hymn, which invoked Ushas (the deity of the dawn), his bonds were loosened and King Harishchandra was also cured of his illness.

According to the Aitareya Brahmana, the descendants of these 50 sons included the Āndhras, the Mūtibas, the Pulindas, the Pundras, the Shabaras, and the various Dasyu tribes.

The priest conducting the ceremony told the king that he needed to find the animal, or perform a human sacrifice to avert the misfortune resulting from the situation.

The king gave Richika one hundred thousand cows and gold coins, and left with Shunahshepa.

Shunahshepa sought the sage's refuge, asking him to do something that would conclude the king's rite successfully but also save his life.

Ambarisha concluded the Ashvamedha ceremony successfully, and Shunahshepa recited Vishwamitra's hymns as he was about to be sacrificed.

[3][4] According to scholars like Arthur Berriedale Keith and Rudolf von Roth, the intent of the legend is to show that human sacrifice (purushamedha) is an unacceptable practice.

However, its variants in Aitareya Brahmana and Sankhyana Srauta Sutra are an origin myth for the outcasts, who are described as the descendants of Vishvamitra's disobedient sons.

A 16th century Mughal era depiction of Ambarisha offering Sunahsepha in sacrifice