An intoxicated Hamilton clubgoer has been prosecuted for taking the law into her own hands - literally - during a routine bar check.

Nikki Christina Galloway, a mother-of-two, was yesterday sentenced in Hamilton District Court to 60 hours' community work after pleading guilty to doing an indecent act with the intent to insult or offend.

Galloway, 36, was drinking at Hamilton's Shenanigans Irish Pub about midnight on May 18 last year when a constable entered the bar to carry out a liquor licence check.

In what her lawyer termed "a grossly stupid act", Galloway groped the officer's groin as he made his way through the bar.

Galloway was ejected from the bar, prompting her to yell abuse and suggest the officer was enjoying the attention.

In explanation, Galloway later said she did not realise her victim was a police officer and she had "been doing this to men all night".

Defence counsel Michael Talbot said Galloway was aware her behaviour was stupid and was linked to her drinking that night.

Judge Philip Connell observed Galloway was probably "grossly embarrassed" by her offending and rightly so.

He said Galloway's behaviour was not good role modelling to her two children.

The charge carries a maximum sentence of two years' jail. Judge Connell declined to impose a fine, instead opting for a sentence of community work.

"You need to take control of yourself if you're inclined to do that when drunk," he told Galloway.