A Sydney man has been sentenced to 36 years in prison for stabbing his neighbour during a "violent, ferocious and inhumane" terrorist attack.

Key points: Khan stabbed his neighbour Wayne Greenhalgh who sustained life-threatening injuries, but survived the attack

Khan stabbed his neighbour Wayne Greenhalgh who sustained life-threatening injuries, but survived the attack Khan, who police said was inspired by ISIS, said he wanted to be "a martyr" and egged on police to shoot him

Khan, who police said was inspired by ISIS, said he wanted to be "a martyr" and egged on police to shoot him He will spend at least 27 years behind bars, with the the judge describing his ideology as "immoral and depraved"

Ihsas Khan, who likened his attack to eating a chocolate bar, stabbed Wayne Greenhalgh in a driveway in Minto, in the city's south west, on September 10, 2016.

Mr Greenhalgh survived his life-threatening injuries after running to a nearby hair dressing salon for help.

In the Supreme Court in Parramatta on Wednesday, Justice Geoffrew Bellew said Khan was motivated by an "immoral and depraved" ideology to kill in the name of religion.

"The offender's attack was violent, ferocious and inhumane," he said.

"The offender did not just set out to harm Mr Greenhalgh, he was on a mission to kill him."

Justice Bellew sentenced Khan to 36 years in prison with a non-parole period of 27 years.

There were loud cheers and applause from the public gallery, where Mr Greenhalgh sat with his family.

"You beauty," one person yelled.

Khan showed little reaction but stared at the family.

Wayne Greenhalgh (right) and his wife celebrate outside court. ( AAP: Joel Carrett )

Justice Bellew said Khan carried out an attack on not only Mr Greenhalgh, but the community as a whole.

"It represented a violation of the most fundamental of democratic rights to which all members of the community are entitled."

Outside court, Mr Greenhalgh said he was happy Khan "got what he deserved" and he did not accept his apology.

Mr Greenhalgh was repeatedly stabbed in the head, neck, arms, hands, torso and stomach.

He suffers ongoing nerve damage, insomnia, and post-traumatic stress disorder and is unable to work.

Attack planned around September 11

Khan was found guilty by a jury last month — the sixth jury to hear the case after a series of mistrials.

During one of his trials, the court heard Khan wanted to be "a martyr" and egged on police to shoot him after stabbing Mr Greenhalgh.

He was tasered, taken into custody and later charged with committing a terrorist act with the intent to influence the Australian Government.

Khan pleaded not guilty, on the grounds of mental illness.

Ihsas Khan in Wayne Greenhalgh's driveaway, holding the knife used to stab him. ( Supplied: A Current Affair )

A jury agreed with the prosecution's argument Khan had been planning to attack a civilian at random on, or around, September 11 to coincide with the anniversary of the Al Qaeda attacks on the United States.

Khan picked out his neighbour, Mr Greenhalgh, because he believed he was wearing a shirt with some sort of American motif on it.

Locked out of the hairdressers, Khan stabbed at the glass door with the knife saying: "They killed our people, he should be killed too", "Allah Akbar" and "they tried to kill my brothers and sisters in Iraq", the court heard.

During a police interview Khan was asked how he felt about the stabbing.

"How do you feel about eating a Picnic bar?" he replied.

"You don't really think about it, do you?"

Justice Bellew said that analogy was "chilling in the extreme".

He said but for the courage and fearlessness and "extraordinary bravery" of witnesses who stepped in to intervene, Mr Greenhalgh may have died.