A young man who claimed a stolen phone was his own but could not open it when challenged by gardai had told a "likely story", a judge said.
Christopher O'Grady (27) first said he bought the phone, which had a picture of women socialising on the cover, but then maintained he found it outside a McDonald's.
Judge Michael Walsh ordered him to carry out 120 hours of community service, instead of a three-month prison sentence.
O'Grady, of Cedarwood Park, Cox's Demesne, Dundalk, Co Louth, pleaded guilty to possession of stolen property.
He was not charged with stealing the phone.
Dublin District Court heard gardai saw O'Grady acting suspiciously and looking in the windows of parked cars at Wellington Quay at 3.40pm on March 24.
When asked why he was doing this, O'Grady "said he was not".
When searched, he had a mobile phone in his pocket with a picture on the cover of three women socialising.
He said the phone was his property and gardai told him to enter the pin but he said that the battery needed charging.
However, it was turned on and he said he was unable to enter the pin. He then told gardai he had bought it for €50.
He was asked if he was aware of the value of the phone and he said: "Yeah, a couple of hundred euro."
The phone had been stolen from a woman while she was socialising in Temple Bar the night before, the court heard.
Separately, O'Grady admitted threatening, abusive and insulting behaviour when he was caught smoking drugs in a city centre car park.
The court heard that last February 13 gardai were called to Fleet Street car park, where security said a man became aggressive after refusing to leave when he was seen smoking heroin from a metal pipe.
The accused had had problems with heroin over the years, his lawyer said. He had a relapse after a bereavement.
The accused maintained he had found the phone outside McDonald's and had been "foolish" in keeping it.
"A likely story," Judge Walsh said.
The phone had now been returned to its owner.
O'Grady had previous convictions for public order offences.