Updated

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 Sunday.

The 59-year-old was stabbed several times while walking through a park in suburban Minto in southwest Sydney on Saturday afternoon and is in 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 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.

Khan and his victim 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," Burn told reporters.

Khan shouted words at the scene, which led police to believe he was inspired by the IS group, Burn said.

"We know that this person has strong religious beliefs inspired by ISIS. What made him act yesterday we don't know," she said.

Khan had previously been charged with a property-related offence, she said.

"He has had a couple of interactions with local police over matters where we might say his behavior was odd or unusual," Burn said. "He is a person of concern."

Despite his unusual behavior, 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," Brandis told reporters. "They are an inspiration to us all. They acted heroically and we should all be in their debt."

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.