An inmate serving life at HMP Isle of Wight viciously attacked a prison officer — played out in graphic video shown to magistrates — because his medication was not ready for collection.

Martin Hanrahan admitted assaulting an emergency worker by beating, on March 7, when he appeared at the Isle of Wight Magistates' Court, by video link, on Friday, July 14.

At 9am, the 51-year-old attended the healthcare centre hoping to collect some medication, but when told it was not ready, he confronted the member of staff, which led to two offcers intervening.

When the officers asked Hanrahan to calm down and return to his cell, he refused and began to shout.

On hearing this, another officer came and tried to hold his arm to escort him away, but Hanrahan broke free and started to swing 'windmill' punches at him — four of them connecting with his head and face, said Anisa Alrubaie, prosecuting.

The officer said two punches caught his mouth, splitting his lip.

Video of the attack was shown to the court, which graphically showed Hanrahan's attack, before the officer and two colleagues hauled him to the floor.

Hanrahan has 21 convictions for 46 offences — including a serious sexual assault against a woman, for which he received a minimum eight years and six months imprisonment, by Isleworth Crown Court in 2016.

For Hanrahan, Oscar Vincent said the assault was "an expression of frustration", rather than him targeting any specific officers.

"He is diagnosed with long-term mental health issues, including paranoid schizophrenia, and he was expecting to collect medication.

"It caused him much distress, but he regrets his behaviour and has apologised to the officer personally."

When sentencing Hanrahan, presiding magistrate Fiona Gornall said: "It was a very nasty, unprovoked attack," for which he received 12 weeks' imprisonment, concurrent to his life sentence, with an order to pay a £154 surcharge on release.