A shop worker who helped himself to £5,500 from the till at an Edinburgh convenience store has been ordered to carry out 160 hours community service.
Richard Humphries, 32, used the cash from the shop on Blackford Avenue, to fund an online gambling habit, which had left him with debts of £50,000.
Edinburgh Sheriff Court heard he created phantom cash back transactions to hide the fact money was missing.
He admitted carrying out the offence between 10 August 2009 and 12 May 2010.
At an earlier hearing, fiscal depute Malcolm Stewart told Edinburgh Sheriff Court that Humphries was assistant manager at The Avenue Stores and was in charge of checking all the sales.
Mr Stewart added that Humphries had tried to commit suicide but that his family were supporting him and his parents had paid off his debt to the store.
The court heard Humphries had a long-standing gambling addiction but was determined to right his wrongs and was now in employment again after losing his job at the shop.
Defence agent Murray Robertson said: "It is a significant breach of trust. However, he feels a weight has been lifted from him given his wife and family are now aware of it and he has gained alternative employment."
Sheriff Frank Crowe said he would impose unpaid work as an alternative to custody.
He said: "You are a very fortunate man that despite this grave breach of trust you have your family standing by you and they have assisted you in squaring up the money side of things, the money that you stole effectively.
"It is a serious breach of trust when you are employed to take money."
The Sheriff added he was pleased Humphries was taking steps to address his gambling problem and that it was clear he got carried away.