Locals caught the rapist, Monir Hossain, 60, son of Korban Ali of Tangail’s Mirzapur upazila, red-handed and handed him over to police.
He used to sell Chatpati, a local food item, in the area.
Locals said the incident took place in the evening when the child alone went out of her residence to buy Chatpati. Monir took her to a nearby place and raped her there.
Hearing the victim’s scream, locals rushed in, caught the rapist and gave him a good thrashing.
On information, police went to the spot and took Monir under their custody.
Quazi Mainul Islam, officer-in-charge of Keraniganj Model Police Station, said the victim’s mother filed a case over the incident.
The victim was taken to Dhaka Medical College Hospital around 8pm, he added.