Shasta (IAST Śāstā) is a Hindu deity of Dravidian origin, usually associated with Shiva and Vishnu. In Hindu mythology, Shasta is considered to be another name of Ayyappan, described as the offspring of Shiva and Mohini. His principal function is to act as a kuladevata of a given clan, as well as act as a guardian of a village's boundaries. In South India, he is identified with the Ayyanar in Tamil Nadu and the Ayyappan in Kerala.
Shasta is a generic term that means "Teacher, Guide, Lord, Ruler" in Sanskrit. In South India, a number of deities are associated with Shasta. The Tamil song Shasta Varavu states that there are eight important incarnations and forms of Shasta. This is also present in the agamic work Dyana Ratnavali. The Ashta-Shasta (eight Shastas) are Aadhi Maha Shasta, Dharma Shasta (Ayyappan), Gnana Shasta, Kalyana Varadha Shasta, Sammohana Shasta, Santhana Prapti Shasta, Veda Shasta and Veera Shasta. Brahma Shasta is another term associated with Kartikeya.
In Tamil Nadu, Aiyanar is used as the regional name of the deity Shasta. The earliest reference to Aiynar-Shasta is from the Arcot district in Tamil Nadu. The stones are dated to the 3rd century C.E. They read "Ayanappa; a shrine to Cattan." This is followed by another inscription in Uraiyur near Tiruchirapalli which is dated to the 4th century C.E.
Literary references to Aiyanar-Cattan are found in Silappatikaram, a Tamil work dated to the 4th to 5th centuries C.E. The Tamil Sangam classics Purananuru, Akananuru etc. refer to Ayyanar and "Cattan" in many poems. There are several numerous references to Shasta in Sangam works. Some Tamil inscriptions of the Sangam period and a few of the later Pallava and Chola period coming in from various parts of the kingdoms refer to him as Sevugan and Mahasasta. The hymns of some Alvars like Tirumangai Alvar and Nammalvar in temples like Tirumogur near Madurai refer to Shasta. A Sanskrit work dated prior to the 7th century known as the Brahmanda Purana mentions Shasta as Harihara suta, or the son of Shiva and Narayana (Vishnu), the oppressor of the asuras.