When she was a three, the red and white beads tied around her neck by the adults in her southern Indian village were a plaything for Hanamavva.

But they marked out her future; never allowed to be married, she was now ostensibly a "servant of God", a devadasi. Hanamavva had been dedicated to the Hindu goddess Vellamma, an ancient practice which once might have won her a future of comfort and respect, but now doomed her to a squalid life as a prostitute from the age of 13.

"I just wanted to kill myself – I planned to climb to the roof of the brothel and throw myself off but the thought of leaving my family destitute prevented me," she said. It was five years before she could escape, with her two young sons, and try to make a new life for herself. But even then she still had to fend off the constant –sometimes violent – sexual harrassment by men in her village.

But now Hanamavva has joined a growing grassroots movement in the Indian states where the illegal practice survives. Former devadasi who brave the stigma and social pressures to leave the way of life have formed self-help groups and are fighting to stop other children being dedicated to what is no longer a holy calling to the temples but a direct path into sexual exploitation.

Like Shobha, now 36, who joined a group and now visits devadasi women, offering support to those who want to leave and trying to convince families not to dedicate their children. She runs awareness programmes at temples and fairs, trying to gather support in communities and lobbying district officials for help for devadasi old and young.

It is an uphill battle in some wretchedly poor provinces where selling a daughter under a divine mandate – often encouraged by the local priest or a powerful villager with an eye on the girl for himself – might be the only way to feed the rest of a family.

Interview with filmmaker Beeban Kidron, plus exclusive clips from her new film about India's devadasi guardian.co.uk

Shobha was the youngest of seven children and was dedicated aged eight. At 12, she was taken out of school and her first paying "partner" was her 35-year-old brother-in-law. "No one asked my consent, money talks. Girls like me grow up in living fear of reaching puberty." She was determined that her own daughter would escape the same fate. "The devadasi system isn't about religion. Its about economics. We're just traded like a commodity. I know the pains as a serving devadasi, how exploitative this practice is. We are the victims. What happened to me shouldn't happen in another's life. I want to stop this and I decided to fight."

Sometimes several generations from the same family are devadasi, like Lalitha, whose mother and grandmother were dedicated before her. Like Hanamavva, however, Lalitha is determined to stop the practice. "I was shocked to find out I have to practice this system because I have been dedicated. I was determined not to become devadasi. In my village there are 100 devadasi. About 20 are between 12 and 18. I try to persuade all my friends not to get into this evil practice but they are vulnerable. Both the parents and the community are pressuring them."

Devadasi remain common in the poorest towns and villages of provinces of the states of Karnataka and Andhra Pradesh. In 2006, the National Legal Service Authority in Bangalore launched an awareness programme for police and judges, and said there were 250,000 "devadasi" girls who had been dedicated to Yellamma and Khandoba temples. But the remoteness of many of the villages, and the continuing rise in demand from organised traffickers who pay well for young girls to fill the brothels of India's vast cities, is thwarting efforts to combat the system.

"The social customs combined with economic pressures have pushed girls into the system. The fact that not one of them is married and most of them have children not only leaves them in a traumatised condition but renders their children stigmatised forever," said an authority spokesman.

Stretching back for centuries, the original devadasi were trained in prayer, dance and music. Holy enough to bring blessings and banish the "evil eye", they were often courtesans but with a freedom of control over their lives that was not permitted to ordinary Indian women. It was British colonialists, with their Victorian morality, who first outlawed the practice. The Indian government followed suit in the 1980s.

This present practice is far from those ancient customs, however. Anna Feuchtwang, chief executive of the international charity EveryChild, the only NGO working with the women of southern India to tackle devadasi, said the issue was a child protection one.

"The sexual exploitation of children, which takes place with this practice is illegal and must be stopped. Action is needed in India to strengthen child protection and tackle the root causes of poverty which drive families to dedicate their daughters."

• EveryChild has helped with the making of a unique documentary about the devadasi to be broadcast on the BBC4 on Monday 24 January. In Sex, Death and the Gods, by Beeban Kidron, many women trapped in the system talked of their lack of options, pressures from family and community, and the threat of HIV and Aids.