David Clark, 36, had been arrested and was in a cell at Fareham Police Station when the incident happened.
He was approached by PC Robert Blowers who wanted to take his clothes for forensic analysis.
But Clark, who had been drinking earlier in
the day, became angry and spat at the officer, catching him on his trousers.
Defence lawyer Michael Williams said: 'He felt he had been wrongly arrested, and this caused him great annoyance. He was not thinking rationally.
'Although it's unpleasant I do not think there was any danger of him coming into contact with the officer.'
He added that no saliva actually landed on the officer's skin.
After the incident Clark, of Privett Road, Fareham, was given a tray of food which, he claimed, he thought police officers had spat in, and so he threw it across his cell.
The food went over the floor and walls, so Clark was charged with criminal damage as well as assaulting a police officer.
The incident happened on October 26 last year. No charges were brought in respect of the original offence for which Clark was arrested.
Magistrates sitting at Fareham on Monday sentenced Clark to 28 days in prison for the spitting offence – which he has already served because he has been in custody since May 6 on two other charges.
Clark was not given a separate penalty for throwing the food.
The full article contains 260 words and appears in The News newspaper.