An Indonesian shaman has been arrested for allegedly keeping a young woman as a sex slave in a cave for 15 years.

The woman, 28, was found in a stone cave in the backyard of the 83-year-old shaman's house in the Tolitoli district of Central Sulawesi province after a tip-off from one of her relatives, police said.

"She looked confused when she was found and at times said she wanted to return to the cave," district police chief Muhammad Iqbal Alquddusy said.

A video posted on YouTube showed the woman being helped to walk by neighbours after she was taken out of captivity.

The self-styled shaman, nicknamed Jago, took the woman captive when she was 13 and forced her to have sex repeatedly with him by telling her that she was possessed by a genie, Alquddusy said.

Indonesia is a predominantly Muslim country but old beliefs about spirits and other paranormal activity are still held by some.

The man's wife, child and an in-law, who is a relative of the victim, did not dare tell other people because he threatened to kill them if they did so.

The man has been charged with offences under Indonesia's child protection laws, which carry a maximum sentence of 15 years in prison.