The girl is presently admitted in a hospital and her condition is critical.
Meanwhile, the 26-year-old accused has been arrested.
The girl lives with her parents, both workers at a private enterprise, and grandmother on the second floor of a building at Kalyanpuri in which the accused too is a co-tenant, police said.
The incident took place on Saturday afternoon when the girl was sleeping beside her grandmother and the accused whisked her away to his room.
When he allegedly forced himself upon her, the girl screamed following which the accused gagged her.
Failing to manage the situation, he then tried to strangulate her, police said.
The girl fell unconscious and the accused assumed that she was dead.
He first decided to dump her outside the building but there were too many people outside. He changed his plans and went to the girl’s house once again to drop her there and secretly return to his own room.
But this time the girl’s grandmother was awake looking for the child and raised an alarm when she saw the accused carrying her granddaughter, who was unconscious and bleeding from her private parts, police said.
Locals held the accused and thrashed him.
They also rushed the girl to Lal Bahadur Shastri Hospital, where she was admitted in a critical condition.
It was the hospital authorities which informed the police.
When a police team went to the building, locals handed over the accused to them.
He was arrested immediately, charged under IPC sections for rape, attempt to murder and criminal intimidation and provisions of Protection of Children from Sexual Offences Act, police said.