A council IT expert who admitted swindling more than £1 million of public cash has been jailed.
Mark Conway, 52, from Brechin began siphoning off local authority money into his own bank account to pay online gambling debts.
He got away with the fraud for seven years before bosses at Dundee City Council grew suspicious.
Conway, who admitted defrauding £1,065,085, lost the money betting on football matches.
The offence was committed between August 2009 and May last year.
Only £7,337 of the money was recovered.
Judge Graeme Buchanan told first offender Conway: “I accept it was your addiction to gambling that led to the commission of this crime.
“However, that is no excuse for what you did.”
Judge Buchanan told Conway it was “a serious breach of trust.”
He told Conway that, but for his early guilty plea, he would have jailed him for eight years.
Conway was instead sentenced for five years and four months.
The court was told Conway has signed over most of his pension and lump sum – amounting to £258,966 – to the council.
His home, which has £49,000 equity, will be sold and the cash will go to the council.
Defence counsel Gavin Anderson said: “Initially he tried to pay off his gambling debts by legitimate means and remortgage his home twice.
“His aim was always to pay back the money with his gambling winnings, but that never happened.
“He would occasionally win a few thousand pounds, but then gambled it away.”
Mr Anderson said the online gambling companies referred to Conway as a VIP customer and he added: “They did much to encourage him to bet.
“He was betting on football matches.”
The defence counsel added: “Mr Conway is ashamed and embarrassed by the whole matter and has expressed remorse.
“He has lost his career, his home, most of his pension and many of his friends.
“For some years Dundee City Council was unaware of what was happening.
“Each year Mr Conway expected the end of year audit would uncover what he was doing.”
The court was told that Conway sought help for his gambling problems in 2016.
Prosecutor Rosemary Guinnane revealed Conway had been the council’s top financial IT expert and had “unrestricted access” to their computer systems.
But he exploited a loophole to send cash to his own account while pretending it was going to genuine suppliers.
Ms Guinnane said: “During 2009, the accused had become indebted due to online gambling.
“During the period August 2009 to May 2016, the accused’s actions went undetected by the council’s audit procedures.”
However, in May last year, an employee became aware of a £7,337 payment to a building firm and thought it was unusual that it was made to a Nationwide building society account.
On May 25 last year, Conway created a further Scottish Fuels invoice, this time using his Santander bank account details.
The same day, the council’s head of customer service and IT, Gregory Colgan, was made aware of the discrepancy.
Senior officials then suspended Conway on full pay.
Auditors were called in to identify how funds had been diverted to Conway’s accounts.
They also identified various weaknesses in the council’s accounting practices that allowed the fraud to remain undetected for so long.”
Conway showed no emotion as he was led away to begin his sentence.
Speaking following the sentence, Nicky Patrick, Procurator Fiscal for Homicide and Major Crime, said: “Mark Conway was convicted of a serious offence – a fraud over a seven year period.
“It is a crime made all the more serious due to the trust placed in him by his employers and the transfer of a large amount of city council funds into his own accounts.
“We welcome the sentence, which reflects the seriousness of the offences.
“When you are in a position of public trust, you will be held accountable.”