Three people were detained for questioning for the rape while 14 others were detained for destroying and damaging government vehicles and property.
The rape took place Thursday afternoon at the North Delhi Municipal Corporation (NDMC)-run school in Mangolpuri area when the child went there for her midday meal. "The victim's parents came to know about the rape next day after she was found bleeding," a police official said.
The girl was so traumatized that she did not dare to tell anyone about the incident when she returned home from the school, said a neighbour.
She was taken to the Sanjay Gandhi Memorial Hospital Friday morning where a medical examination confirmed rape.
"A case has been registered and school authorities are being questioned," the police official added.
The girl told the police the attacker was not known to her. The three people detained include two teachers of the school and a watchman.
Police have also questioned a few residents neighbouring the school.
Demanding swift action against culprits, residents of Mangolpuri staged a three-hour demonstration outside the local police station Friday morning, leading to traffic chaos in the area. Police had to use batons to disperse the crowds.
The situation turned violent again in the afternoon when a mob again collected outside the Sanjay Gandhi Memorial Hospital, where the girl was examined, and started pelting stones, damaging three low-floor Delhi Transport Corporation (DTC) buses and some police vehicles.
No one was injured in the protest, said the officer.
Hospital officials said the girl was alright and has been sent home after the examination.
However, a police contingent has been stationed in the area.
"The whole area near the MCD school in Mangolpuri and the Sanjay Gandhi Memorial Hospital has been cordoned off. Around 500 policemen have been deployed in the area to control the mob," said the officer.
According to the officer, some NGO activists also arrived and joined the protests.
"The situation is tense but under control," Special Commissioner of Police (Law and Order) Deepak Mishra told IANS.
The North DMC has also begun an inquiry into the incident. "We have initiated an inquiry and sent an officer to the spot to collect a report of the incident," Additional Municipal Commissioner Deepak Asthir told IANS.
Delhi Chief Minister Sheila Dikshit expressed her deep shock, anguish and pain over the incident.
Describing the incident as inhuman and shameful, she said: "The Corporations must strengthen their existing security infrastructure."
In the past few years, six such incidents of minors being molested or raped in schools have occurred. Recently, a schoolteacher in a South Delhi municipal school was arrested for allegedly molesting girl students over several months.
Timeline: Previous cases of sexual assaults in Delhi schools
Cases of sexual violence against girls and women continue to occur in the national capital, the most recent being the rape of an eight-year-old girl in her municipal school in northwest Delhi Friday.
Here is a timeline of similar attacks on girls in schools:
December 2012: A three-year-old girl sedated and raped inside a playschool in Sagarpur in west Delhi by the school owner's 35-year-old husband.
October 2012: A school van driver arrested for raping a 12-year-old girl from south Delhi. He was caught by resident welfare association members.
July 2012: A school teacher held in Hauz Qazi in central Delhi for raping a 17-year-old student for several years. He subdued her with threats of uploading her photos on internet.
February 2012: A South Delhi Municipal Corporation school teacher held for molesting girl students aged between 11 and 13 in Greater Kailash for several months.
July 2009: An unidentified man attempted to rape a 12-year-old girl at a municipal school in Rohini in north Delhi.
July 2008: A 10-year-old student raped in a girls' toilet by two men in a municipal primary school in Ashok Vihar in north-west Delhi. They entered the school by jumping over its boundary wall. The municipal corporation then spent Rs.300 crore on erecting high walls and installing grills in around 300 schools.