The deity of an early medieval temple can be compared to a feudal
lord. He was the lord of the universe in a general abstract sense but in
effect the master of the life and property of his tenants and servants.
Like a landlord the temple engaged labour to cultivate its lands. With
invocation songs in the morning, bathing ceremonies, food offerings
and entertainment he was treated like an earthly being. And true to
a lord it required a large body of attendants, from preists to dancing
girls. The deity was provided with all the amenities and pleasures of
life – a big and comfortable house, a host of servants, best of food,
choicest jewellery, attractive garments, and wives and concubines. The
devadasis had, therefore, to be employed to give company to the god
as wives and concubines. In other words, they had to serve the desires of the priests, the sole interpreters of the god's wishes on earth. However, for this they required ideological support and political
backing which they did not lack.
Now some new mythologies had to be invented providing sanction
to all these requirements. Accordingly, we find first mythological
evidence regarding the devadasi system in the Matsyapurana, which
was written some time in the Gupta period. The mythology says after
the destruction of the Yaduvamsis in the course of the devasura
sangrama several thousand wives of Lord Krishna were abducted,
seduced and defiled by the dasas and consequently they became
prostitutes. These fallen women once asked the sage Dalbya about
their duties (dharma). They were advised by the learned sage to accept
prostitution as their profession and live in the state capitals and in the
temples. They were told that kings and princes were like their
husbands, and on payment they could satisfy others also. Interestingly,
these women were asked to bestow special favour on the Brāhmaṇas if
they went to them on Sunday for the purpose of satisfying their sexual
urge. Some Puranas recommend even the purchase of beautiful girls
for dedication to the Sun temple.
The author is referring to Chapter 70 - Vow of Aṅgadāna, the method of
worshipping Kāma (part 1 and part 2) from Matsya Purāṇa, which says the following.
Once upon a time thousands and thousands of the demons (Dānavas, Asuras, Daityas and Rakṣāsas) were killed in the war between the Devas and the demons. Indra told their numberless widows and those women who were forcibly seized and enjoyed, to lead the life of prostitutes and remain devoted to the kings and the Devas.
Indra continued, "you should look upon, with equal eye, the kings your masters and on Śūdra. All of you will attain prosperity, according to your fate. You should satisfy those who would come to you with adequate sum of money to enjoy your company, even if they be poor. But you should not give pleasure to proud men. You should give away cow, land, grain and gold, according to your means, in charity on the sacred day of worshipping the Devas or the ancestors. You should act as the Brāhmaṇas in work and speech.
In addition to this, I shall also tell you an ordinance (or vrata), which all of you should blindly practise."
...
The women folk should then worship the Lord, whose body is Cupid himself, by offering Him incense, flowers, sandal and eatables.
Afterwards, the Brāhmaṇa, well versed in the Vedanta, who must be virtuous and free from bodily deformity, should be honoured with the offerings of incense, flowers, sandal.
And a quantity (of the measure Prastha) of uncooked rice, along with a pot, full of clarified butter, should be given away to the same Brāhmaṇa, after saying, 'Lord Mādhava, be pleased.'
That Brāhmaṇa should be well fed and be devoutly looked upon as Cupid, for the sake of sexual enjoyment.
Each and every desire of that Brāhmaṇa should be satisfied by the woman devotee. She should, with all heart and soul and with a smile on her face, yield herself up to him.
...
O Keśava! As the Goddess Lakṣmī never remains apart from you, in the same way make my body Your dwelling place.
After that, the Brāhmaṇa, accepting the image of Cupid, should pronounce the following Vedic mantra. 'Ka Idaṃ Kasmāt.'
Then the Brāhmaṇa should dismissed, after being circumambulated, and beddings and other things should be sent to the house of the Brāhmaṇa.
Henceforth, any Brāhmaṇa coming to them for the sake of sexual enjoyment on a Sunday, should be respected and honoured. In this way, the good Brāhmaṇas should be kept satisfied for a period of thirteen months; but if they go abroad, their course of action will be different.
...
If, with the consent of that Brāhmaṇa, another handsome person come to them, these women should, with love and affection and to the best of their ability, perform all the fifty-eight kinds of observances of Love, favourite of man and gods, which would lead to pregnancy and which is not harmful to their soul's welfare.
I have described to you this vrata in detail, which, when always performed, never leads the prostitutes to sin.
I have fully related to you what Indra said to the women of the Danavas (demons) in ancient days.
O, Women of beauty! This vrata is the dispeller of all sins and giver of innumerable benefits. I wish well of you; hence you should do as I told you.
...