Violence outside a South African school between residents and activists from the Economic Freedom Fighters (EFF) over alleged racism could be used to "cause racial polarisation", President Cyril Ramaphosa has warned.
The EFF said its members were attacked by "right-wingers" while protesting against a whites-only graduation party.
The school in Cape Town said it had nothing to do with the event.
White-minority rule ended in South Africa in 1994.
BBC Africa Live: Updates on this and other stories
How race relations in the 'rainbow nation' have become toxic
The groups playing on the fears of a 'white genocide'
In a statement, Mr Ramaphosa said that "the spectacle of parents and protestors coming to blows at the school gate is deeply unfortunate".
"What happened... brings back hurtful memories of a past we should never seek to return to."
He called on all sides to exercise restraint and resolve the tensions peacefully.
A legalised system of racial discrimination, known as apartheid, was abolished in the run up to the country's first democratic election in 1994, when all race groups voted.
Racist education policies under the system became a rallying point for anti-apartheid activists.
On Monday, in response to the call by the EFF opposition party for a protest at Brackenfell High, parents, residents and security guards gathered outside the school, the Cape Argus newspaper reports.
Pictures and video being shared online showed EFF members being shouted at and then fighting breaking out, which the police struggled to contain.
One man has been arrested for allegedly firing shots in the air.
In a statement, the EFF, which is the second-biggest opposition party in South Africa, said the protest was peaceful and "armed right-wingers" attacked its members "in what was a display of pure white arrogance".
"It must be further noted that since 1994, there has never been a single black teacher at Brackenfell High School, which reveals how entrenched racism is at the school at an institutional level," the party added.
A parent and former pupil were quoted by local media as saying the school was not racist, and the protest was uncalled for.
Brackenfell High has distanced itself from the private graduation party, which, the EFF said, was only attended by white people. Two school teachers were also reportedly present.
'Don't bring back segregation'
"The masked ball... was a private party organised by the parents... and did not fall under the control of the school," the school authorities said in a letter to parents sent on Sunday.
They added that only 42 of the school's 254 graduating students attended and that Brackenfell High does not "condone or accommodate any events that are exclusively reserved for certain groups".
The school also asked parents not to get involved in any violence.
Referring to the reports that only white people attended the party, the South African Human Rights Commission, which is a statutory body, said that "no-one should be allowed to bring back racial segregation to this country".
"The deep racial divisions of South Africa's apartheid and colonial past cannot be healed while children are socialised separately on the basis of race," it added.