Keshvamurthy, 30 walked out to freedom on Sunday after the neighbours, on coming to know about his confinement, broke the wall of the room and rescued him, police said.
Preliminary investigations revealed that Keshvamurthy was held in solitary confinement in a room in his house since 1995 by his mother Chowdamma at Lokkapura village for objecting to her becoming a "Devadasi" (a religious tradition in which girls are "married" to God) after getting separated from her husband.
The mother did not allow Keshavamurthy to go out even to answer nature's call and served food through a window of his room all these years, police said.
The man, who sported long hair and beard, was given a shave by a barber and his hair was trimmed and later was taken to National Institute of Mental Health and Neurosciences at Bangalore for a checkup, according to reports.
Defending her action, Chowdamma alleged that Keshvamurthy in his younger days used to beat his house inmates including her and his brother. He also objected to her becoming a "Devadasi".
"Hence, to teach him a lesson, I held him captive," she told the police.
Chowdamma said she used to serve food in his room but did not allow him to attend to nature's call outside.