SERANG, Indonesia (Reuters) - Indonesian rice farmer Usman has kept his 19-year-old son chained in the family's tiny wooden hut for more than a month, reluctant to release the mentally disturbed boy for fear he might wander off and steal neighbors' livestock.

The teenager is one of nearly 20,000 Indonesian victims of mental illness kept in shackles by families and government institutions, an illegal practice President Joko Widodo's administration aims to stamp out by the end of 2017.

"He stole buffaloes and clothes," Usman told Reuters as he sat beside his son Deden, in the hut in the district of Serang, on Indonesia's island of Java.

"We are the ones who are embarrassed, so I chained him up in case he disturbs the neighbors."

Usman lets a doctor give his son a medical check-up every two weeks, but says he will not free the boy until he is "more stable".

In a program launched this year, Indonesia sends teams of workers into often-remote hamlets to help free patients kept in chains and ensure they get the medical treatment they need.

"The social ministry and agencies across Indonesia recognize that there are still a lot of such cases, so we are determined to end the shackling practice by December 2017," said Social Affairs Minister Khofifah Indar Parawansa.

The world's fourth most populous nation has outlawed such shackling for decades but the practice continues, particularly in poor areas.

In the village of Jambu, 80 km (50 miles) from the capital, Jakarta, 28-year-old Jumiya has spent more than four years locked in a dark wooden shed after showing signs of a mental disorder following her return from a job in Syria, her family said.

"People spend years locked up in chains, wooden stocks, or goat sheds because families don't know what else to do, and the government doesn't do a good job of offering humane alternatives," said Kriti Sharma, the author of a report on the issue published this month by Human Rights Watch.

The group said shackling was sometimes linked to superstitious beliefs, with families attributing medical disorders such as schizophrenia or depression to the action of curses, black magic and evil spirits.

Human Rights Watch urged the government to develop more educational programs on the treatment of mental illness, boost training for health care professionals and widen protections for disabled Indonesians.

In Serang, the teenaged Deden said he was not sure why his father had chained him up in the first place.

"I don't know, maybe I created trouble," the soft-spoken boy told Reuters, with his left hand shackled to a tree.

(Reporting by Johan Purnomo in Serang and Angie Teo in Jakarta; Additional reporting by Quincy De Neve; Writing by Randy Fabi; Editing by Clarence Fernandez)