A teenager who threatened to attack gardai and told them he would give them the HIV virus was off his medication at the time.
Brandon Shumba (19) suffers from a "relatively serious" condition which "impacts on his behaviour", his lawyer told a court.
Gardai were forced to pepper spray Shumba to arrest him, and he said he was ashamed of his behaviour.
Judge Cormac Dunne imposed an eight-month sentence suspended for two years.
Shumba, of no fixed abode, had admitted before Swords District Court to a breach of the peace at Daly's Lane, Rush, on April 27 last year.
Sgt Terri Ferguson said gardai were called to the scene following reports of an aggress- ive youth.
The sergeant said Shumba told gardai to back away and told them he had HIV. He threatened to attack gardai and give them the virus.
He also told officers to "ring gardai in Ballymum" and that they will "tell you how violent I can be".
Sgt Ferguson said Shumba tried to punch gardai and threatened to smash the windows of their patrol car.
Officers were forced to spray Shumba across the eyes to make an arrest.
The court heard Shumba had 31 previous convictions.
Defence lawyer Annette Kealy said Shumba had a "troub- led and difficult childhood" and spent time in Oberstown.
His upbringing was volatile and his parents had their own difficulties.
Shumba was taking anti-psychotic medication and was stabilised. Ms Kealy said he had problems with drugs in the past but was now clean.
He was in a stable relationship, was working part-time in retail and had a young son.
Ms Kealy also said he regretted his behaviour and was ashamed by it.
She said the defendant was willing to work with the probation services and was "motivated to change".
Imposing the suspended sentence, Judge Dunne said Shumba's behaviour had imposed a significant danger to the personal safety of gardai.