A radicalised NSW prisoner will spend decades in jail for carving an Islamic State slogan on a cellmate’s forehead after abandoning a plan for a police shooting terrorist attack.

Bourhan Hraichie, 22, pleaded guilty in the NSW Supreme Court to four offences over his long-running plan to organise a terrorist attack on Bankstown police station and causing grievous bodily harm to Michael O’Keefe with intent to murder.

He also threatened to kill NSW prisons boss Peter Severin in a letter in which he boasted about turning O’Keefe into an “IS sketchpad”.

NSW Supreme Court Justice Peter Johnson on Friday sentenced Hraichie to a total of 34 years in jail, with a non-parole period of 29 years, for the “disturbing mix” of violent crimes.

He cheered as he was sentenced in the supreme court.

Hraichie, who has already spent much of his adolescent and adult life in detention, made plans to shoot police at Bankstown police station in Sydney in late 2015.

But after breaching his parole for unrelated offences and becoming unable to convince others to carry out his plans, Hraichie turned to terror behind bars.

In April 2016, hours after meeting new cellmate O’Keefe, Hraichie bashed the ex- solider, tied him up with bedsheets and waterboarded him with a blanket and hot water.

O’Keefe had a short moment of respite to cough up water and fall to his knees before Hraichie grabbed a razor and carved “E 4 E” - meaning “eye for an eye” - into the victim’s forehead.

Hraichie later told counter-terrorism police he regretted not using a bigger knife.

As well as writing a letter to the prisons boss in 2016 threatening to “turn your jails in slaughterhouses”, Hraichie penned an unsolicited letter to Justice Johnson this year to make clear his beliefs.

“’I will always support jihad ... and I love my brothers in al-Qaeda,” Hraichie said.

“You are a representative of democracy, a false deity and I would never stand for (one)”.

The letter spelled out Hraichie’s support for the terror shooting of NSW police accountant Curtis Cheng and stated his only regret for the O’Keefe attack was that waterboarding and mutilation were not strictly authorised in his extreme view of Islam.

Hrachie was “firmly committed to violent jihad” and rejected the laws of Australia while maintaining a fixated view “adverse to democracy and free society”, Justice Johnson said.

“If anything, his attitude has hardened (since 2016),” Justice Johnson said.

The combined sentence of 34 years included terms of 20 years for the O’Keefe attack, 20 years for the police shooting preparations and six years, three months for the letter to the prisons boss.

Hraichie will be aged 50 when first eligible for parole in 2047.