A 24-year-old man has admitted sending an offensive message to a police officer on Facebook.
James Tarron Keggin, of no fixed abode, pleaded guilty to sending a message by telecommunication as well as affray.
Four counts of assaulting a police officer and one of possessing an offensive weapon were withdrawn.
Prosecutor Barry Swain told the court how, on July 19, Keggin sent a Facebook message to a police constable which included several expletives.
On July 21, police attended an address at Westhill Avenue after a report of a domestic incident between Keggin and his mother which had resulted in her calling ’999’.
During the call Keggin could be heard shouting and swearing with glass smashing.
He was no longer at the address but was found nearby carrying a brick.
He warned two police officers: ’Get back or I’m gonna smash your face in with it. Who’s gonna have it then, you or him?’
When a third officer arrived, Keggin said: ’Oh now here’s the big man trying to sneak up on me, have some of this.’
Police tried to persuade him to put the brick down but Keggin said: ’Do you want it? Do you?’
He threw the brick which missed and police used Pava spray to restrain him.
As he continued to struggle Keggin was hit on the head with a baton after he ducked when an officer aimed the strike at his shoulder.
Keggin was taken to hospital with a head wound and then aimed abuse at paramedics.
The court heard he is in breach of a suspended sentence imposed in March 2017.
Keggin will be sentenced on August 28 after a probation report has been completed.
Deputy High Bailiff Jayne Hughes said that the report should consider all options, including custody.
No bail application was made and Keggin was remanded in custody.



