The man had been arrested on a complaint from the mother of the girl, they said.
The mother raised an alarm on seeing the man attempting to sexually assault the girl sitting on a side wall of a locked house following which neighbours and passersby arrived at the scene and detained him.
He was identified as Muneeshwaran, who grazes cattle and goats.