A 39-year-old man has admitting brandishing an imitation firearm during an attempted robbery at a shop in Ongar, West Dublin.
The court heard Alan Daly of Whitestown Gardens in Dublin 15 kept watch while a co-accused demanded cash.
Daly had committed the offence in March 2016 to try and clear a large drug debt.
He had been beaten up several times by criminals and abducted after losing drugs.
He will be sentenced later this month.