"I find it very difficult to believe the brazenness of how they entered the school," Police Detective Inspector Jim Stewart said. Such school violence is rare in Australia.
The teens, between the ages of 14 and 16, were arrested and will appear in court Tuesday to face more than 100 charges, police said. They have been charged with offenses including assault and malicious damage and could face up to seven years in prison if convicted.
Police refused to say whether the teens were students at the school.
A 43-year-old teacher was treated at a hospital after being hit on the head with a bat when he tried to stop the attackers, and 18 students were treated for cuts from broken glass and other minor injuries, Stewart said.
Two of those students -- a 13-year-old boy and a 14-year-old girl -- were taken to a hospital for further treatment, police said. No one was seriously injured, Stewart said.
Some students reported the gang was armed with two machetes.
"We were having an assembly and a bunch of guys walked in with some machetes and baseball bats and they said they were looking for some kid," an unnamed male student told Ten Network television news.
"Teachers made an announcement; they rushed us all into the class rooms, locked us in," he added.
Another student said children panicked in the classrooms and hid under tables and desks as teachers barricaded doors.
Worried parents rushed to the school as students flooded the airwaves with mobile phone calls and news of the attack was broadcast.
A mother told Ten that "children were passing out -- fainting because they couldn't breathe for panicking."
Stewart said the attackers defied teachers who tried to stop them, but did not challenge police when they arrived, and surrendered their weapons without a struggle. The raid lasted just six minutes, the Education Department in New South Wales state said.
Education Department regional director Tom Urry apologized to the concerned parents who had to wait at the school gates for hours before seeing their children.
"It is a very confusing situation," Urry told Australian Broadcasting Corp. radio.
"Once the police are on site, it's a crime scene, so it's a combination of two departments trying to make sure that when we do release students, we actually release them to people who are their parents," he added.