A man with a history of mental illness is suspected of killing a woman in a Sydney apartment, wounding another woman and trying to stab other people Tuesday afternoon, according to police and witnesses. Authorities commended the bystanders who physically subdued him before he was arrested.

"A number of members of the public physically restrained the offender," Police Superintendent Gavin Wood said. "I want to acknowledge those members of the public who got involved. They were significantly brave people."

The 21-year-old was wielding a 12-inch knife and attempted to stab a number of people near a busy intersection around 2 p.m., witnesses said. He was possibly yelling "Allahu akbar" or "God is great," authorities said.

Paul O'Shaughnessy said he and his brother Luke were working in the office of their recruitment company when they heard yelling from outside. O'Shaughnessy said he heard "extremist" language and the brothers feared it might be a terrorist attack. The two, with their friends Lee Cuthbert and Alex Roberts, began chasing the man, ABC News reported.

"Because obviously, he's wielding a knife," O'Shaughnessy told ABC. "I don't know whether it's an instinct thing or what, but we was like, 'Right, we've just got to try and restrain this guy from doing any more.'"

They began chasing the man and, along with other bystanders, they used a milk crate and a chair to restrain him on the ground. O'Shaughnessy told the Associated Press the man "didn't show any remorse at all."

O'Shaughnessy told ABC that the group of friends has talked about what they would do in a potential attack situation before.

"We talked about it as a team, we said somebody might attack one day and imagine he was in the vicinity what would [we] do?" O'Shaughnessy said.

Prime Minister Scott Morrison said on Twitter that the violence was "deeply concerning" and praised the people who restrained the assailant.

Police have not classified the attack as an act of terrorism, but the suspect had compiled information on his computer about mass killings in North America and New Zealand, New South Wales state Police Commissioner Michael Fuller said.

"It is not currently classed as a terrorist incident. Obviously, as the investigation continues, we will reassess that," New South Wales state Police Commissioner Michael Fuller told reporters.

Mass shooting in Christchurch:New Zealanders turned in more than 10,000 guns

49 dead, 1 suspect charged:New Zealand Christchurch mosque shootings

A gunman who recently killed 22 people at a Texas Walmart appears to have praised the March 15 shootings in Christchurch, New Zealand, where an Australian white supremacist is charged with killing 51 worshippers at two mosques.

Police said a 41-year-old woman with a stab wound to her back was in stable condition at a nearby hospital. The body of a 21-year-old woman was later found in a nearby fourth-floor apartment.

Wood said it appeared that the attack was unprovoked. The man "attempted to stab multiple people. Those attempts, thankfully, were unsuccessful," Wood said.

Uber driver Leon Baghani said the attacker jumped on the hood and then the roof of his Mercedes while wielding a knife as he was driving an elderly couple on the street where the violence occurred.

"For a second, I thought maybe he's wearing a vest of some sort and he's going to detonate himself," Baghani told Ten Network television. "So I quickly accelerated and made a left turn and made sure that he came off the roof of the car."

Biden:Trump 'fanned the flames of white supremacy'

White supremacy:Booker denounces white supremacy at Charleston shooting site

Fuller said the assailant had a history of mental health issues, and that he would be charged.

Contributing: Associated Press