AN alleged self-radicalised Muslim accused of stabbing his neighbour in an Islamic State-inspired attack has passionately apologised to his victim in a Sydney court.

Ihsas Khan has pleaded not guilty to committing a terrorist act and wounding with intent to murder due to mental illness after Wayne Greenhalgh was repeatedly stabbed at a Minto reserve in 2016.

The 24-year-old rose to his feet after Mr Greenhalgh finished giving evidence in the NSW Supreme Court at Parramatta today and directly addressed him.

“Mr Greenhalgh, I’m so sorry for what I did to you,” Khan said. “You are not the guy I thought you were.”

A videoed police interview the day after the attack was played to the jury showing Mr Greenhalgh in hospital covered in bandages and tubes.

He said he’d put his arms up to protect himself after Khan ran at him with a massive knife yelling “I’m going to effing kill you”.

“Luckily I did because the machete was chopping into my arms ... there was blood pouring out of everywhere,” Mr Greenhalgh, a panel saw operator, said in the video.

The Crown alleges Khan wanted to be a martyr and yelled “Allahu Akbar” several times after he attacked the then 57-year-old without warning on Saturday September 10.

“I would have loved to whack him in the bloody head but I couldn’t,” Mr Greenhalgh said.

“There was no doubt at all he was aiming at my head.”

Prosecutor Peter Neil SC said Khan had planned to attack a stranger on September 11, the anniversary of the al-Qaeda attacks on the United States.

However Khan had earlier spotted his victim taking a daily walk while wearing a T-shirt with an American motif and decided to exact “revenge for what he regarded as injustices for Muslims in the Middle East”, Mr Neil said.

But Mr Greenhalgh said on the day of the attack he was actually wearing a T-shirt emblazoned with the words: “World’s greatest farter ... I mean father.”

“I’m a joker,” he told the jury on Tuesday.

Khan inflicted life-threatening injuries on Mr Greenhalgh with a hunting knife, telling him “you rape our women, you rape our children, you bomb our countries”, the court has previously heard.

In the police video, Mr Greenhalgh said neighbourhood friends who tried to ward off Khan with a wooden plank as he took refuge in a nearby hair salon saved his life.

“I would have died if it wasn’t for them,” he said.

Mr Greenhalgh said he hoped his assailant suffered consequences for what he’d done.

“It’s changed my life, it’s ruined my work life ... I don’t know what I’m going to do now,” he said.

Khan attacked police at the scene in 2016 saying he wanted to die, the Crown says.

He asked: “What does it take to get shot by the cops?”

The academic high achiever was suffering from schizophrenia and severe obsessive-compulsive disorder at the time, the jury has been told.