A would-be burglar told the occupants of a house he entered that someone was after him and replied "good" when they told him gardaí were on the way, a court has heard.
James Smith (33) later opened the door of the house to admit the Gardai when they arrived.
Mr Smith, of Mostrim Oaks, Ballymahon Road, Edgeworthstown, Longford, pleaded guilty at Dublin Circuit Criminal Court on Friday last to trespass with intent to commit an offence at Bloomfield Avenue, Dublin 8 on October 4, 2015.
He has 116 previous convictions including 17 for burglary.
Judge Pauline Codd adjourned sentencing to allow for an updated psychological report and a probation report to be prepared.
She fixed a sentence date of April 3, 2017.
Defence counsel, Sandra Frayne BL, will make a plea in mitigation on Smith's behalf on that date.
Garda Kevin Carthy told James Dwyer BL, prosecuting, that the homeowners were woken in the early hours of the morning by a noise downstairs.
They shouted down the stairs that gardaí were on the way.
The man shouted back up the stairs that he needed help and this was good because someone was after him.
He appeared to be confused by a curtain at the door downstairs but was directed by the family to open the door to gardaí when they arrived.
Mr Smith was arrested and told gardai that he had broken into the house to steal things he could sell.
He said he needed money fast and did not know there were people in the house.
He had smashed a kitchen window with a plant pot. He said he had taken drugs and was very sorry.
Garda Carthy agreed with Mr Dwyer that Smith had significant psychological issues and was a drug user.
He agreed with Ms Frayne that nothing was taken from the house.
Subscribe or register today to discover more from DonegalLive.ie
Buy the e-paper of the Donegal Democrat, Donegal People's Press, Donegal Post and Inish Times here for instant access to Donegal's premier news titles.
Keep up with the latest news from Donegal with our daily newsletter featuring the most important stories of the day delivered to your inbox every evening at 5pm.