A man spat in a garda's face and told him he had the HIV virus because he was annoyed he had been arrested.
Sean Grogan (50) had been drinking at a bonfire and was arrested after he swung a bottle of vodka at a second officer.
The defendant, of Home-lawn Avenue, Tallaght, admitted before Tallaght District Court to threatening and abusive behaviour and assaulting Gda William Garbutt at Homelawn Avenue last February 20.
Gda Sean Lawlor told the court that gardai were on patrol when they came across the defendant, who was drinking with a group of young men at a bonfire.
The young men ran away and gardai approached Grogan, who swung a bottle of vodka at Gda James Hughes.
Gda Lawlor said Grogan was arrested.
However, as he was being transported back to Tallaght Garda Station, he spat at the driver, Gda Garbutt, hitting him on the cheek.
The court heard Grogan had 17 previous convictions, but had not been in trouble for more than a decade.
In his victim impact statement, Gda Garbutt said he went back to the garda station where he cleaned up.
He said he was "quite worried" after the assault, because Grogan had blood in his mouth and had told him he had "the virus".
However, Gda Garbutt was fine and did not have to take time off work.
Grogan claimed he spat out blood because his eyes had been gouged and he could not see.
He also claimed he was beaten in the back of the patrol car.
John O'Leary, for the defence, told the court that Grogan should not have reacted in the way he did.
Mr O'Leary said Grogan lived near the bonfire and had felt quite hard done by at being arrested.
Grogan often went across to the bonfire, both to drink and to keep an eye on it, so that it did not burn out of control, Mr O'Leary said.
He described Grogan as a "survivor" who had been born with dyslexia and had spent time in prison.
He also "over-reacts" at times and had "a bit of a temper" but was "likeable".
Judge Patricia McNamara adjourned sentencing for reports.