A teenager threw a 16-inch knife out of a window as armed gardai intercepted a vehicle which had earlier been seen outside a hostel waiting for another individual, a court has heard.
Some members of Ronnie Wilde's extended family were involved in a dispute at the time and he "foolishly and momentarily" aligned himself with one side.
Detectives from the Armed Support Unit (ASU) stopped the vehicle after gardai received two emergency calls.
Judge Paula Murphy ordered a probation report and adjourned sentencing until May.
Wilde (18), of Clanbrassil Terrace, Dublin 8, admitted possession of a 16in knife at Chesterfield Avenue in Phoenix Park last November 19.
Sergeant Geraldine McManigan told Blanchardstown District Court that gardai received a 999 call in relation to a number of males in a vehicle who were outside a hostel and appeared to be waiting for an individual.
Sgt McManigan said gardai then received a second 999 call that the same vehicle was in Phoenix Park.
She said the detectives from the ASU intercepted the car.
Wilde was a passenger in the vehicle and gardai saw him discard a 16in knife out the window.
When gardai searched the vehicle, they found a 12in knife, a broken hurl and an extendable baton, which belonged to the other two people in the vehicle.
The court heard Wilde had 37 previous convictions.
Defence solicitor Simon Fleming said Wilde's father died when he was young, and he had grown up mostly in the care of the State.
He had a number of siblings, as well as a large extended family, and currently lived with his grandmother.
In relation to this incident, Mr Fleming said there was a dispute between first cousins on the defendant's mother's side.
Wilde "foolishly and momentarily aligned himself to a faction in that dispute", he said, but was no longer involved in it.
Mr Fleming also said Wilde came from "a more troubled background" than nearly any other youngster he dealt with.