A homeless man who abused gardaí when caught injecting himself in public was a "determined street sleeper" who had sworn off staying in hostels, a court heard.
George Cullen (39), who was separately found with a penknife in his bag, had been in a downward spiral following the death of a friend in a house fire.
He pleaded guilty to threatening, abusive and insulting behaviour, as well as possession of a weapon.
Judge Bryan Smyth gave him a six-month suspended sentence.
Dublin District Court heard gardaí responded to a report a man was acting suspiciously at Bedford Lane, Temple Bar, at 11.30pm on July 20 last year.
They searched the accused's backpack and found a small penknife, which he gave no valid reason for having. Other belongings were also in the backpack.
On April 26 last year, gardaí were on patrol at Foster's Place at 4.15pm when they saw the accused injecting suspected drugs.
When they told him to stop, he became aggressive, telling the officers to "f**k off numerous times", the court heard.
He again became abusive to gardaí when they confronted him at Copper Alley, Dublin 2, on May 2 last year.
Cullen, who had 38 previous convictions, was originally from Rathfarnham and was put out of the family home because of his drug use, his solicitor Edward Bradbury said.
After that, the place he was staying in Terenure burned down, leading to the death of a friend.
Cullen was a "determined street sleeper", Mr Bradbury said, and he was not going to hostels as he had difficulties there and was "sworn away from them". The knife was among items he had in his backpack "as a homeless individual".
The accused had injured himself, his knee became infected and he was in St James's Hos- pital for three months during the lockdown. He was now living at an aparthotel.
Although he had been an "annoyance" in the city centre, he was usually polite and did not cause difficulty when arrested, Mr Bradbury said.