A South African school has been ordered to suspend allegedly racist hairstyle regulations after black pupils said they had been called monkeys by teachers for wearing banned "afros", and were forced to chemically straighten their hair.

Pretoria High School for Girls was given 21 days on Tuesday to re-assess its rules pertaining to black pupils' hair after protests by students triggered a public dispute over racism.

"Learners feel that they are not allowed to wear Black hairstyles, such as Afro. Specifically, the school policy limits the length of the hairstyle," the education ministry said in a statement.

The ministry said that the school's "code of conduct ... must be reviewed and the clause dealing with hairstyles should be suspended in the meantime".

"Some educators tell them [the pupils] they look like monkeys, or have nests on their heads."

Suspension of the rules on hair styles was issued after talks on Monday between senior staff, pupils and Provincial Education Minister Panyaza Lesufi, who said an inquiry into allegations of racial discrimination would be launched.

At the weekend, defiant black pupils with afro hairstyles and braids held a protest at the school against the long-standing regulations.

"We wanted to show that we have had enough of the bigotry and racism that we face at school", a pupil, who requested anonymity, told Al Jazeera on Monday.

The high school was also accused by the ministry of a heavy-handed response to the protest for calling in police and armed security guards.

"It was odd. We've never had security at assembly before," the pupil said.

Images of the pupil protests went viral, with messages of solidarity on social media using the hashtag #StopRacismAtPretoriaGirlsHigh.

Alumni have also rallied behind the pupils, with one group writing to a university online newspaper to express their anger over "racism, bullying and patently race-based shaming of black women's bodies by staff".

"We pledge our support to the crop of young women leaders who have brought national attention to issues we are sorely aware are rampant not only at Pretoria High School for Girls," the letter said.

The school was historically attended by whites only but it admitted black children following the end of apartheid in 1994.

South Africa is still grappling with racial issues 22 years after the end of white-minority rule, with bitter race rows erupting regularly in politics and on social media.