According to Hindu Mythology the divine Lord Dharmashastha - incarnation of Thaarakka Brahman appeared in the universe consequent on the fusion of the energy of Lord Maha Vishnu in the form of Mohini and Lord Maheswara to uphold doctrine of Dharma in the Universe to put down adharma whenever it takes an upper hands among worldly beings. Dharmashastha, otherwise known Lord Ayyappa appears as a Balaka or Child in Kulathupuzha , as a hunter in Erumeli, as a Grahastha in Ariyankavu, as Vanaprastha in Achankoil, as Sanyasi in Sabarimalai and Jeevan Muktha in Kanthamalai. (Which are representations of different stages of man's development?) There are various versions about the Avatara of Lord Dharmashastha otherwise known as Lord Ayyappan.
Lord Dharmashastha took the Avatara of Ayyappan to destroy demoness Mahishi. Mahishi propitiated Brahma after severe penance & obtained a Boon from him. Celestial or human being should not kill her and only a son born for Lord Mahavishnu & Lord Siva could destroy her provided he is born in the world as human being and served a man for twelve years. After obtaining this boon she started conquering Devas & teasing Sages in the world. Devas could not bear her torture and they represented to Lord Brahma, Lord Siva, Lord Vishnu their miseries & prayed for the destruction of Mahishi. One day the Panthala Raja, a descendant of Pandya Dynasty, went to the forest for hunting. When he reached the bank of the river Pampa he heard an infant-cry and looking about saw a beautiful child lying uncared for. The Raja who had no issues of his own, felt extremely happy at the sight and returned to his palace with the child. The king and the queen brought up the child as their own and christened it Manikanda as it has a precious gem on its neck. Subsequently a male child was born to the queen and the young price also grew up. The queen wanted to crown her own son while the kind was in flavor of Manikanda. The queen and the wicked ministers devised several schemes to get rid of Manikanda. They sent Manikanda to fetch the milk of a tigress for curing the ailment of the queen who pretended to suffer from unbearable headache. The divine boy went to the forest where he met god Indra, who was being pursued by the buffalo-headed demoness Mahishi. At Indra's request Hariharaputra killed Mahishi. In gratitude, Indra asked the Devas to take the form of tigers and tigresses with now-born cubs and follow Manikanda. When they arrived at the palace, the queen and the ministers realized the Manikanda was not an ordinary child. The king welcomed his son and requested him to take charge of the kingdom. Saying that he preferred the forest to the kingdom and wanted to spend the rest of the life in deep meditation, he went in the direction of Sabari Hills. At this juncture a yogi appeared before the king and told him the truth about Manikanda. He advised the King to build a temple for Hariharaputra atop the Sabari Hills and thus was born the pious place that people often refer to as Sabarimalai Ayyappan Temple. The Pandalam Raja is even now the custodian of the ornaments of the deity and they are taken to the temple on festival occasions.