While Māra plays a prominent role in Buddhist texts, he does not seem to appear before Buddhism, at least under that name. However there is another entity who is pre-Buddhist and who shares a name with Māra: Namuci.
Namuci appears as a name of Māra in three or four Pali suttas, usually as commander of an army. He is clearly identified with Māra at AN 4.13:2.4 and SN 2.30:14.3, implicitly at Thag 5.5:2.3, and may in fact be a different individual at DN 20:12.8.
Vedic Namuci is an enemy of Indra. Namuci’s name is explained (in both Pali commentaries and Pāṇini 6-3, 75) as na-muci, “not letting go”, which in the Vedic tradition refers to his capture of the soma and by extension the life-giving waters, while in Buddhism it refers to being trapped in transmigration.
Like most Vedic figures, Namuci’s nature is obscure, except for the fact that he opposed Indra. He is called dāsa, “enemy”, “adversary”, and may have been a general of the native peoples who fought off the Aryans. But the Vedas also are full of astronomical symbolism, so Namuci may have been a god of the dark clouds before the rain, especially in the transition between the dry and rainy seasons. When he is “killed” the waters are released and the soma flows. Or, perhaps more likely, he was both.
Vedic Namuci is a Titan (namucāv āsure, Rig Veda 10.131.4a), while Buddhist Namuci is also a Titan (DN 20:12.8). In this sutta, Māra appears in a separate passage later on. Normally, of course, Māra is believed to be a deva, so Namuci’s appearance here among the Titans suggests that in this context they are not to be identified.
Vedic Namuci was a wily trickster (māyin, Rig Veda 1.53.7c) who was nonetheless outsmarted by Indra (Rig Veda 5.30.6c), having ineffectual armies reliant on women (Rig Veda 5.30.9a). Buddhist Māra was a wily trickster (passim) who was nonetheless outsmarted by the Buddha and his followers (passim), possessing ineffectual armies (DN 20:21.3, AN 4.13:2.3, Snp 3.2) who sent his daughters to do his dirty work (SN 4.25).
As to how the trickster was tricked by Indra, the story goes that Namuci captured Indra and before releasing him made Indra swear not to kill Namuci by wet thing or dry thing, in the night or in the day. Namuci took advantage of his protection to steal the soma from Indra. Indra was powerless until he came up with an ingenious solution: to dismember him with foam (Rig Veda 8.14.13) at dawn (Śatapatha Brāhmaṇa 12.7.3.1).
- (This story fulfills a specific role in the evolution of the mythological hero, a role played in Greek myth by the “wily” Odysseus. Odysseus was not the greatest warrior, but it was due to his wisdom and cunning that Troy was overcome. The Trojan horse was his idea—a horse that is not a horse, an offering that is not an offering, a sign of repentance that was . These stories are pivotal in that they show the victory of brain over brawn.)
As a result of his theft of soma, Vedic Namuci is said to be “wicked” (pāpmā vai namuciḥ, Śatapatha Brāhmaṇa 12.7.3, Maitrāyaṇī Saṃhitā 4.4.4), while Māra’s most characteristic epithet is “Wicked One” (māro pāpimā).
Having defeated Namuci, Indra severed his head. But this created a further problem, for Namuci’s head contained blood mixed with soma, something revolting to the gods (Śatapatha Brāhmaṇa 12.7.3.4, Maitrāyaṇī Saṃhitā 4.4.4). In doing so, Namuci introduced death (mṛtyu), i.e. blood, to the deathless (amṛta) soma. This is a precursor to his epithet Maccurāja, “King of Death”, and indeed to the name Māra, “Murderer”.
There is, further, a striking verbal equivalence, for the defeat of Namuci opened the way for “the progress of Manu” (manave gātum, Rig Veda 5.30.7c). Here, the progress of Manu refers to the spread of the Aryan peoples who were Manu’s children. In the suttas, Namuci’s defeat is celebrated by a god with the unusual name Māṇavagāmiya (SN 2.30:15.1). Here, gāmiya can be read as a secondary derivation from gama, “going”, yielding the sense, “The Progress of Manu’s Children”. Here the term can have the Buddhist sense of the path of the Aryans. But the use of this name in this context surely requires the Buddhist author to be familiar with the specific Vedic passage.
A further parallel emerges much later, for the Pali commentary says that an epithet of Māra was Pajāpati, “lord of the generations”. Mahābhārata (Ādi Parva, Chapter 65, Stanza 22) says that Namuci was in fact the son of Prajāpati Kaśyapa by his wife Danu.
There are many stories of both Namuci and Māra, and doubtless a further search would identify more in common. However this is more than enough to show that the Buddhist conception of Māra is largely drawn from Vedic Namuci, and indeed Māra can be considered the Buddhist evolution of the same entity, most commonly referred to by a different name, just as his arch-nemesis Indra is called Sakka in Buddhism.
One attribute of Mara that I cannot trace in Namuci before the Buddha is his role as arch-sensualist. This is emphasized occasionally in later Sanskrit texts, where multiple Māras appear as deathly acolytes of the God of Sex, or may be identified with the same god (Gītagovinda 3). Indeed, even in the suttas his sensuality is not as prominent as one might imagine. In any case, it is unclear whether such references are influenced by Buddhism. Perhaps his sensuality is a secondary feature derived from the fact that, as the the murderer, his main job is to trap people in transmigration, and sensuality is a prime tool for achieving this end.