A 25-year-old man who had just appeared in Tauranga District Court for drunken behaviour went outside where he headlocked and punched a total stranger.
Samuel Charles Watson, 25, unemployed, had to be restrained by court staff after his Christmas Eve appearance.
He was put into the cells until police arrived to deal with him.
In the same court today, Judge Christopher Harding sentenced Watson to 100 hours community work and nine months supervision on charges of common assault, disorderly behaviour, resisting police and two counts of assaulting police.
"All of this occurred when you were intoxicated," said the judge.
"You take to someone outside court for no apparent reason and only a few days before, you behaved in a riotous manner."
Watson had a history of alcohol-related offending and now accepted he had to do something about it, Judge Harding said.
Prosecuting, Sergeant Mark Graham said Watson was heavily intoxicated about 3.15pm on December 22 and urinated up the driveway at a Mt Maunganui address.
When he went to sleep on the front lawn, the occupants called the police, saying they did not know him and wanted him removed.
Officers arrived and Watson became abusive and aggressive, Mr Graham said.
He spat at one, the spit landing on her trousers.
When arrested, the defendant kicked out four or five times at the leg of another constable and spat on his trousers.
While the officers attempted to restrain him, Watson continued to lash out and became obstructive, the court heard.
He was OC sprayed and eventually handcuffed. But in the back of the patrol car he continued to abuse police and spat repeatedly at the escorting officer.
When he appeared in court two days later, Watson was heavily intoxicated.
Upon leaving, he approached an unknown man, grabbed him around the head and locked his arm around the victim's neck.
After punching the man in the head once, the defendant let him go.
Lawyer Craig Tuck said his client had no recollection of what had happened but had "taken on board" his need for help and was well underway with drug and alcohol counselling.