A man ignited a firework and aimed it at a garda car on patrol on a city street as children stood nearby, a court heard.
Josh McKenna (25) "made good his escape" after the firework hit the car but was identified and later arrested.
McKenna, of Baker's Yard, Portland Street, north Dublin, pleaded guilty to unlawfully igniting a firework.
Judge Bryan Smyth adjourned the case for the prod- uction of a probation report.
Dublin District Court heard the incident happened at Mariner's Port in the north inner city on September 25 last year.
Gardaí were on patrol in the Sheriff Street area and the accused was standing on the street.
He ignited a firework and aimed it at the garda's patrol car, which it hit.
Members of the public, including children, were in the area and the accused made good his escape, the court heard. He was arrested on a later date.
McKenna also pleaded guilty to separate drugs offences.
On February 27 last year, gardaí saw the accused get out of a taxi on Sheriff Street with a "large bulge" in his hoodie.
He ran when gardaí shouted at him to stop for a drugs search, fleeing down a laneway and into a house before being arrested in a rear garden.
On March 6 last year, gardaí saw a number of drugs transactions taking place on Sheriff Street and shouted at McKenna to stop. He tried to flee and discarded four deals of suspected cannabis.
McKenna had previous convictions for assault, public order and other offences.
All the charges before the court related to the Sheriff Street area last year, defence solicitor Rory Staines said.
The accused had not been associating with a peer group he had previously hung out with.
This had consequences, and he was the victim of a home invasion that ended up with him being hospitalised.
The accused was a "vulner- able person, open to being taken advantage of by other people".
Judge Smyth said the charges would ordinarily attract a prison sentence, but agreed to "stay his hand" until a probation report was prepared.