A drunken man punched a garda in the face in an unprovoked attack that he put down to a "sugary alcoholic drink" he had downed in a pub.
Stephen Somers (60) asked the garda if he was "on strike" and called him an idiot before he struck him at a south Dublin supermarket.
The officer had called at the store to view CCTV in enquiries that had nothing to do with Somers.
Judge Paula Murphy adjourned the case for a pre-sentence probation report.
Somers, a jobless carpenter from Belgrave Road, Rathmines, admitted assaulting the garda, as well as public drunkenness and threatening, abusive and insulting behaviour.
Dublin District Court heard that the incident happened at Lidl, in Ranelagh, on December 15, 2017.
The garda had gone to the shop to view CCTV of an unrelated incident when the accused asked him if he was on strike.
He also called the officer "an idiot and useless".
When he was cautioned that he was committing public order offences, Somers began to walk away but then turned and struck the garda underneath his left eye.
Somers had no previous convictions and had not come to the attention of the gardai since the incident.
The occurrence was out of character for the accused, who was unmarried and lived in rented accommodation, his lawyer said.
He was a carpenter and had worked all over the world.
Somers did not generally have a problem with alcohol, his lawyer said.
On the day in question he had been in his local pub and had had a "sugary alcoholic drink" that he did not usually drink.
"He drank it very fast," his solicitor said.
The accused had very little recollection of the incident owing to his level of intoxication on the day in question.
Somers had never engaged in this type of behaviour before and would make a charity donation.
Judge Murphy adjourned the case until next March and said the accused should have come up with €500 in compensation by then.