A gap-year student from Ayrshire who attempted to rob a bookmakers to pay off gambling debts has been jailed for five years and eight months.
Christopher McSorley, 26, from Patna, used a toy gun to hold up a branch of Ladbrokes in Ayr on 25 May this year.
The High Court in Edinburgh heard how he was arrested after being wrestled to the ground by three customers.
McSorley later told police he had read of other raids where no one was caught and thought it would be "easy money".
The court heard how McSorley completed two years of an accountancy degree at Glasgow University before taking a year out in 2009.
During this time he started gambling and at the time of the offence was in debt for up to £3,000.
After reading in a local newspaper that no-one had been caught for a series of bookmaker robberies, McSorley resolved to carry out a similar raid to clear his debts.
The court heard how he walked into the bookmakers wearing sun glasses, a baseball cap and with a bandana covering the lower part of his face.
He pointed the toy gun at female staff and threw a carrier bag to the floor telling them to open gaming machines and get the money out of them.
He then told customers not to move and the staff not to press panic alarms. A gaming machine was opened and notes taken out but one of the staff also managed to press an alarm.
While McSorley was focusing his attention on the staff three customers took hold of him from behind and wrestled him to the floor.
The gun fell from his grip as he was punched and kicked repeatedly to the head and body. A stool was then put over him pinning him to the ground.
McSorley later told officers that he decided to carry out the robbery in "a moment of madness" as he had recently lost money on roulette machines in a pub and at another bookmakers.
Passing sentence, judge Lady Smith told McSorley: "To decide that the way to deal with the financial problems which you had brought upon yourself was to prey on those who work in commercial premises by going into Ladbrokes and presenting a gun at the people working there is a very serious matter."