A man from Wrexham had stolen so he would be arrested and get a warm bed for the night, a court was told.
Craig Lambert, 42, had been sleeping rough for some time.
His solicitor, Simon Simmons, told Flintshire Magistrates Court that when the weather was fine, everything was okay but in recent times it had been very cold.
“He could not take another cold night,” said Mr Simmons.
Lambert knew he would be provided with a blanket or a duvet in the cells.
However, things were looking up and he now had a permanent address.
Lambert, of Bryn Hafod, Caia Park, Wrexham, admitted shoplifting of Yanky Candles and other items valued at £32.
He told police he stole them to help pay for food because he was hungry.
But Mr Simmons told the Mold court: “He did it to obtain a duvet.”
Magistrates decided not to activate a suspended prison sentence and as a penalty he was ordered to pay the £32 compensation.
See full story in the Leader