Angry villagers in Andhra Pradesh set ablaze a man who had allegedly killed a four-year-old boy as sacrifice to goddess Kali in order to achieve "divine powers" and "wealth".

The accused, identified as 35-year-old P Tirumala Rao, is undergoing treatment at Kandukur hospital with 40 per cent burns. The incident took place on Wednesday in Pokur village at Valetivaripalem mandal in Prakasam district of the state, The Times of India reported.

Villagers have alleged that Tirumala practiced black magic and sacrificed the boy, Sagar, believing he would obtain divine powers and wealth. He is said to have collected the blood in a bottle after severing the boy's head to offer to goddesses.

Rao had allegedly kidnapped Sagar while he was on his way back home from an anganwadi. Sagar's headless body was later found at Tirumala's home when the boy's mother Adilakshmi, accompanied by her husband and accused's brother Venkata Rao, went there looking for her son.

The incident enraged the villagers, who caught hold of Tirumala in the outskirts of the village. They then thrashed him and set him on fire after tying him to a tree.

However, he was rescued by the elders in the village, who later informed about the incident to the police. He was then rushed to a hospital in Kandukur.

Deputy superintendent of police Srinivasa Rao said the incident prima facie looked like a case of human sacrifice. He said they will question Tirumala when he recovers.

Police suspect that Tirumala strangled Sagar before severing his head. "We found a rope from the residence which the accused might have used to strangle the boy," a police officer said.