Man (29) had a knife hidden in his sock
A young man caught with a knife in his sock went "off the rails" after his mother died last year, a court heard.
Mark Maguire (29) tried to run away from gardai and he resisted arrest.
Judge David McHugh imposed a five-month sentence, but suspended it for two years.
The incident took place at Main Street in Finglas on September 27, 2015.
Sergeant Mary Doherty said gardai stopped and searched Maguire and found a knife hidden in his sock.
Maguire tried to run away and he had to be restrained.
He was then placed in a station cell.
The court heard Maguire has 43 previous convictions, but his last public-order conviction was in 2013.
The defendant, with an address at Hazelcroft Gardens in Finglas, admitted before Blanchardstown District Court to possession of a knife, threatening and abusive behaviour and resisting arrest.
Defence lawyer Jennifer Jackson said Maguire had no contact with his father and his mother had a gambling addiction.
As a result, Ms Jackson said Maguire was "reared on the street", and later developed problems with cannabis, benzodiazepines and cocaine.
Maguire's mother died in June and he went "off the rails" for a while. Ms Jackson also said Maguire was doing well now and was completing an adult education programme.