A radicalised inmate who carved an Islamic State-inspired message into the forehead of his cellmate has been sentenced to 34 years in prison for the "hateful and cruel" attack.

Key points: Hraichie carved "e4e" — a reference to "an eye for an eye" — into a cellmate's forehead

Hraichie carved "e4e" — a reference to "an eye for an eye" — into a cellmate's forehead He claimed his attack on Michael O'Keefe was "Islamic State-inspired"

He claimed his attack on Michael O'Keefe was "Islamic State-inspired" Justice Peter Johnson said Hraichie was "a sad but dangerous criminal"

Bourhan Hraichie, 22, pleaded guilty to four charges including doing an act in preparation for a terrorist act, causing grievous bodily harm and wounding with intent to murder.

The charges related to the attack on his cellmate Michael O'Keefe at Kempsey jail in 2016 and an October 2015 plan to shoot police on the steps of Bankstown police station and film it.

Hraichie sat slouched in his chair in the District Court at Parramatta for much of the sentencing and started murmuring at one point, prompting the judge to tell him to be silent.

Hraichie claimed Mr O'Keefe, a former soldier, provoked him by saying racist things against Muslims and telling him he killed Muslims while serving in the army overseas, the court heard.

Michael O'Keefe has been permanently scarred from the attack. ( Supplied )

Mr O'Keefe had never served overseas and claimed he only told Hraichie he had been in the army for eight years.

The court heard Mr O'Keefe now wears a beanie to cover his scars and still suffers from post-traumatic stress disorder, flashbacks, anxiety and sleeping difficulties.

Justice Peter Johnson described the attack was "ferocious and sustained".

"Although not a terrorist act, it was a hateful and cruel attack," he told the court.

Justice Johnson said Hraichie saw himself as "a type of warrior for his cause", but nothing could be further from the truth.

"He is a sad but dangerous criminal with fixed views which place at risk persons who may be around him," he said.

The court has previously heard Hraichie once sent a letter to the Corrective Services Commissioner saying he had "turned your soldier into an Islamic State sketch pad".

In 2016, Hraichie obtained guns and knives to use against Bankstown police due to their involvement in counter-terrorism operations.

Hraichie, who has also praised the man behind the murder of police accountant Curtis Cheng, made admissions to Federal Police that demonstrated a lack of remorse.

He won't be available for parole until 2047.