A serial burglar was snared after his DNA was found on a piece of an ice lolly he spat out at the scene of a break-in.
Quentin Smith, of Kipling Road, Chesterfield, had only been released from prison a month before he raided a property in the town, a court heard.
The occupants were asleep upstairs as the 39-year-old and an unknown accomplice ransacked the downstairs of the home, taking a TV, a wallet and helping themselves to food from the fridge and freezer.
Of the items he took from the freezer was an ice lolly which he ate as he looked through the property looking for things to steal.
But he spat some of it out and it was discovered and analysed by the police who matched it to Smith.
Handing him a five-year prison sentence at Derby Crown Court, sitting at the city’s magistrates’ court, Recorder Sally Hancox said: "The ongoing desperation and idiocy of your actions have really been brought to a head this time because DNA was left on ice cream you had eaten while you made your way through the ground floor of the property looking for items to steal.
"Being in your own home and later discovering that a stranger has been in your home while you are asleep must be a terrifying one.
"You were inside someone’s house, in the middle of the night, helping yourself to their personal items.
"And your record shows me that I will not be the first judge to have told you this."
Sarah Allen, prosecuting, said Smith's offending included 14 separate convictions for burglary dating back to the early 1990s when he was a youth.
She said the latest took place at a property in Swaddale Avenue, Chesterfield, in the early hours of April 21.
Miss Allen said: "The occupants had gone to bed around 10.30pm and the man woke up the next days and went downstairs to notice the house had been burgled.
"There was a space where the TV had been and the fridge and freezer were open.
"Ice lollies from the freezer had been consumed in the house and part of a lolly stick which had been spat out saw police get the defendant's DNA from it."
Miss Allen said the total value of items taken was £500 and CCTV later obtained from a neighbour showed Smith and an unknown accomplice getting in through a window at around 2am.
She said Smith had only been released from prison a month before his latest offence after serving half of a four-year sentence, also for burglary.
Kevin Jones, mitigating, said his client committed the offence to pay off a drug debt.
He said: "He is a burglar but having said that he is now 39 years of age and he is tired of this sort of lifestyle.
"He knows that his new sentence will start from today."