A homeless man faced being sent back to prison when he sheltered from the rain in a Sutton shop from which he is banned for shoplifting, a court heard.
Hayden Rivers went into Wilkos, at 8.20am, on August 10, breaching a restraining order which bans him from the store until July next year.
"He was out in the morning and it was raining cats and dogs," said Chris Perry, mitigating.
"He asked a store assistant if he could stay and they said "no" and he left. He wasn't engaging in any criminal behaviour."
He said Rivers, who was released from prison five weeks ago, had a "terrible record" for shop thefts, and was facing "an immediate return to custody."
He urged magistrates to be "extremely pragmatic", as Rivers had received his first benefits payment and had not fallen back into drug use.
He said Rivers needs accommodation, help for his drug dependency and some form of income.
"It would be a crying shame to send him back to prison," Mr Perry added.
Rivers, 40, care of Church Street, admitted the breach when he appeared at Mansfield Magistrates Court, on Friday.
He was released having served a day's detention, and was advised to start paying off the fines of nearly £5,000 he owes to the court.
Click here for more Mansfield crime stories.