A man has avoided a prison sentence for taking part in a “nasty” attempted robbery of a pizza delivery man while high on ecstasy.

Daniel Duffy (21) and Stephen Dargle (19), both of Annamoe Terrace, Cabra, both pleaded guilty to attempted robbery at Drumalee Grove off the North Circular Road on October 10, 2017.

Garda Brian Kenny told Dublin Circuit Criminal Court that when the delivery man went to the address, Dargle came up to him and told him “give me that delivery or I’m going to stab you”.

He said he had a knife and the victim could see the handle of a knife which he held in his jacket pocket.

The victim ran away but Dargle chased him and pulled the knife out.

The victim, a foreign national, was scared and screamed and knocked on the door of one of the flats on the road.

Dargle came at him again and the man tried again to get away but Duffy blocked his path.

The victim threw a bottle of a mineral drink at Dargle and screamed out again. Some neighbours came out and began shouting at Dargle to get away.

Both men were identified when gardai spoke to a woman whose mobile phone they had used to order the pizza delivery.

They told gardai they were high on ecstasy tablets at the time. Duffy said he had also been snorting cocaine. He said he was sorry and that it wouldn’t happen again.

Judge Melanie Greally said Duffy’s previous convictions were limited to a period of homelessness and acute drug addiction in the summer of 2017.

She said he is a young man and is remorseful. She noted he had brought €500 to court as a token of remorse and ordered this to be given to the victim, who had to take a month off work after the attack.

Judge Greally noted he had stayed out of trouble since this incident. She suspended a sentence of three and a half years on condition he keep the peace and engage with drug awareness and offence focused work with the Probation Service.

She adjourned Dargle’s sentencing to October 18, next.