Thousands of people angry over alleged police inaction after a six-year-old girl was raped at her school in southern India rallied today to demand that authorities arrest those responsible.

More than 4,000 parents and relatives of children who attend the school in Bangalore, India's technology hub, shouted slogans against the school's administration and demanded that police arrest those involved in the incident, which happened on July 2 but was only reported this week.

They carried placards reading "Enough is enough" and "We want justice", and walked more than two miles (4km) to one of the Bangalore's main police stations.

Police said the girl was assaulted when she left her classroom to go to the toilet. They said she was recovering from the incident, but did not give further details.

The rape has raised questions about the safety of India's schoolchildren and sparked nationwide outrage over rampant sexual violence against girls and women. The school has refused to take responsibility for the crime.

Angry politicians discussed the incident in the state assembly yesterday and demanded that the government of Karnataka state, of which Bangalore is the capital, punish the school principal and other administrators who allegedly tried to hush it up.

The parents have said they will keep their children out of school until steps are in place to ensure their safety.

Police said eight members of the school's staff had been detained for questioning.

The protesters squatted outside a police station and refused to move until the city's police chief assured them the suspects would be arrested.

Official statistics say about 25,000 rapes are committed every year in India, a nation of 1.2 billion people. Activists, though, say that number is just a tiny percentage of the actual number, since victims are often pressed by family or police to stay quiet about sexual assaults.

Indian officials, who for decades had done little about sexual violence, have faced growing public anger since the fatal gang rape in December 2012 of a young woman on a moving New Delhi bus, an attack which sparked national outrage.

The outcry led the federal government to rush through legislation doubling prison terms for rapists to 20 years and criminalising voyeurism, stalking and the trafficking of women. The law also makes it a crime for officers to refuse to open cases when complaints are made.