A chance theft from a car netted a drug user £7,000 in cash.
Joseph Service smashed the window of a Honda Civic to steal a bag he spotted behind the driver's seat.
Service spent most of the estimated £7,000 which was in the bag on cocaine, South Northumbria Magistrates' Court heard.
"The owner of the car deals in plant and machinery," said Keith Laidlaw, prosecuting.
"He had travelled to this area from his home in Aberdeen to buy some equipment.
"Earlier in the day he had bought an item for about £6,000, and went to Fencehouses to look at another possible purchase.
"He parked outside a storage site at Old Station Court, but within a very short time his car was broken into."
The court heard police traced Service from blood left near the car's broken window.
"He was arrested and interviewed," added Mr Laidlaw. "He said he saw the bag, and thought it might contain some money.
"Service said he broke the car's window with his fist to take the bag, and had spent most of the money on cocaine."
Service, 34, of Elmwood Street, Houghton, admitted theft on May 22, and attempted theft on June 9.
"The later offence was at a Gentoo compound in Houghton," said Mr Laidlaw.
"Service and another man were seen on CCTV in the compound in the early hours.
"They attempted to break into two vans, causing damage to the locks.
"A pair of bolt croppers was found near the perimeter of the compound."
Tony Southwick, defending, said the theft of the cash was opportunistic.
"Mr Service had no idea there was so much money in the bag," added Mr Southwick.
"He still doesn't know how much there was, he never counted it, but he accepts it was a lot.
"Mr Service has been in and out of prison, but there have been gaps in his offending which shows he can behave himself.
"He complied with the post-release supervision requirements from his last sentence."
Service was sentenced to 30 weeks in prison, suspended for two years, including 30 days of rehabilitation activity.
He was ordered to pay £3,000 compensation to the owner of the cash, and £10 compensation to Gentoo.
The court heard Service already owes more than £4,000 to the court.
The compensation will be added to his fines account, and be deducted at a weekly rate from his benefits.