A man charged with committing a terrorist act and attempted murder after allegedly stabbing a man in Sydney was inspired by the Islamic State group, police said.
Wayne Greenhalgh, 59, was stabbed several times while walking through a park in suburban Minto in south-west Sydney on Saturday afternoon and is in a critical condition, police said in a statement.
The suspect, Ihsas Khan, 22, also attempted to stab a police officer before he was arrested, police said. He was charged on Sunday and faces a potential life prison sentence if convicted.
Khan was refused bail in the Parramatta Bail Court and his case was adjourned until Wednesday. He did not enter pleas.
Prime Minister Malcolm Turnbull noted that the attack came on the eve of the 15th anniversary of the al-Qaida attacks on the United States.
"Connecting them both is a violent Islamist ideology," Mr Turnbull said.
Khan and Greenhalgh did not know each other, and New South Wales Deputy Police Commissioner Catherine Burn described the attack as planned and deliberate.
"This was clearly a very volatile, a very violent situation that police and the members of the community were confronted with," she said.
Khan shouted words at the scene, which led police to believe he was inspired by the IS group, she added.
"We know that this person has strong religious beliefs inspired by ISIS. What made him act yesterday we don't know," she said.
The victim's wife, Bronwyn Greenhalgh, said her husband had a punctured lung and had lost several fingers.
She said her husband was attacked with a machete.
Khan had previously been charged with a property-related offence, Ms Burn said.
Vietnam war veteran Les King said Khan had stolen and destroyed Australian flags from his fence in 2013. Ten reported Kahn was charged with malicious damage but escaped punishment due to this mental health.
"He has had a couple of interactions with local police over matters where we might say his behaviour was odd or unusual," Ms Burn said. "He is a person of concern."
Despite his unusual behaviour, he was not known to be connected with any terrorist group, she said.
"This really highlights the challenge that this is the new face of terrorism," she added.
Federal Attorney General George Brandis said bystanders had put their own lives at risk by intervening in the attack.
"It may very well be but for the bravery of those citizens to intervene, the victim's life would have been lost," Mr Brandis said.
An 18-year-old man was arrested on Thursday outside the Sydney Opera House after allegedly telling security guards he was under instructions to carry out an attack by the IS group.
Counterterrorism investigators charged the teen with threatening to destroy property. Police said he was was carrying two canisters of automotive fluid.
His arrest came days after the IS urged followers to stab, shoot, poison and run over Australians at iconic locations including the Opera House.
The teen appeared in a Sydney court on Friday, where the judge ordered him to undergo a psychiatric assessment.
The government plans to introduce legislation to Parliament this week that would enable courts to keep prisoners convicted of terrorist offences behind bars for indefinite periods.
Legislation is to be introduced in November that will create a new offence of "advocating genocide." The crime will enable police to make an earlier arrest when someone is radicalising others.
Control orders that can force suspects to wear tracking devices and obey curfews could apply to 14-year-olds. Currently the minimum age is 16.
The burden of evidence would also be reduced for a court to jail a suspect with a preventative detention order on the basis that a terrorist attack could occur within two weeks.