The man on trial for the attempted murder of his neighbour in the Sydney suburb of Minto compared stabbing the man to like eating a chocolate bar, a Sydney court heard on Wednesday.

Ihsas Khan, 22, was charged with committing a terrorist act with the intent to influence the Australian Government and attempted murder for stabbing Wayne Greenhalgh with a hunting knife on September 10, 2016.

Mr Khan has pleaded not guilty on the grounds of mental illness.

The court was shown a police interview of Mr Khan.

During an interview with a detective, Mr Khan said he felt nothing about stabbing Mr Greenhalgh.

"How do you feel about eating a Picnic bar? You don't really think about it," he said.

The detective asked him whether he regretted what he did.

"No, not at all," Mr Khan replied.

"This person you stabbed today, if he died how would that make you feel?" the detective asked.

"Nothing," Mr Khan replied.

"Can you tell me why you're here?" the detective asked.

"I tried to slaughter a guy," Mr Khan replied.

Blood on the floor of a hair salon where Mr Greenhalgh ran after he was stabbed. ( ABC News: Jackson Vernon )

Mr Khan said he stabbed Mr Greenhalgh to avenge the rape of an Iraqi woman by American soldiers. In the interview with detectives he also admitted he was a sympathiser of Islamic State.

He also said he was trying to copy Farhad Jabar, the man who shot dead police accountant Curtis Cheng in 2015.

"Have you ever met Farhad Jabar?" the detective asked.

"I wish," Mr Khan said.

Mr Khan said his goal was "to kill and be killed, simple as that."

The jury had previously heard in court Mr Greenhalgh was walking his dog when Mr Khan attacked him with a hunting knife, telling him he was going to kill him and saying: "You rape our women, you rape our children, you bomb our countries".

Mr Greenhalgh sustained life-threatening injuries, but managed to run into a local hairdressers.