An IT specialist stole more than £1m from a local authority.

Mark Conway diverted public money to his own accounts after running up debts on online gambling websites in a fraud that went undetected for nearly seven years.

Conway, 52, formerly of Latch Road in Brechin, Angus, defrauded his employer Dundee City Council during his crime spree before being suspended on full pay.

He admitted obtaining the money by fraud from the council between August 6, 2009, and May 25 last year.

A judge at the High Court in Edinburgh told Conway: "This is a very serious matter indeed.

"Your counsel, and no doubt you yourself, recognise realistically there is really only one possible disposal."

Judge Graeme Buchanan QC remanded him in custody ahead of sentencing later this month.

Conway made entries in the local authority's computer system pretending to represent sums due to genuine suppliers to the council but had the money paid into his bank and building society accounts.

Advocate depute Rosemary Guinnane said: "He was an IT officer specialising in financial IT systems and was regarded as the council's primary specialist in these systems.

"He was given wide access to the computer systems."

The prosecutor said Conway had "unrestricted access" to financial computer systems used for recoding invoices from suppliers and processing payments.

She said: "During 2009, the accused had become indebted due to his use of online gambling websites.

"In an effort to obtain further funds to pay off a credit card bill, on or about August 6 the accused created an entry to reflect a legitimate sum invoiced by Scottish Fuels which was due to be paid by the council.

"The payment ledger entry on the financial system was made using an interface between the live system an the proto system - a dummy system used for testing and training."

She added the entry appeared no different from any other relating to the firm, which supplied fuel to the council and was a regular, legitimate recipient of funds from the local authority.

The entry contained the account details of Conway's Nationwide building society account, however, rather Scottish Fuels.

Ms Guinnane said: "This invoice was for £17,912 and was paid without question by the council the following day.

"Conway went on to make further entries which were paid by council officials who believed they were making legitimate payments to service providers to the local authority.

"As the majority of the ledger entries were marked as 'Scottish Fuels' it is believed that the volatility of fuel prices along with the variability of usage contributed to none of the payments being questioned at the time."

Up to April 2013, the council made 17 payments recorded as being paid to Scottish Fuels but actually went into Conway's accounts.

From June 2013, he used the names of other suppliers to the council along with the fuel firm.

The advocate depute said: "During the period August 2009 to May 2016 the accused's actions went undetected by the council's audit procedures."

"During the latter month an employee carrying out an exercise became aware of a £7337 payment to a building firm and thought it was unusual that it was made to a Nationwide building society account."

Another employee tried to trace details of the invoice and found no trace of a remittance slip so contacted the IT department and logged a call asking for someone to look into it.

The record of the call subsequently disappeared. A trace later confirmed it had gone to an account of Conway's.

Conway later claimed he had been running a fraud invoice through the dummy system and it had linked to a live network by mistake but the payment had not gone out.

He said: "I think it was me running a report and I need to get in touch with banking to get the money back in Dundee City Council's account."

On May 25 last year he created a further Scottish Fuels invoice but with 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 and was briefed on the situation.

Senior officials then decided to suspend Conway on full pay.

The advocate depute said auditors were called in to identify how funds had been diverted to Conway's accounts.

She said: "They also identified various weaknesses in the council's accounting practices that allowed the fraud to remain undetected for so long.

"The total value of funds fraudulently obtained was £1,065,085.32, of which £7337.58 has been returned to the council, leaving an outstanding total of £1,058,512.74."

Defence counsel Gavin Anderson said a background report would be required on Conway ahead of sentencing but made no motion to continue his bail.

He said Conway had previously made "full admissions of guilt".

The Crown has raised proceedings to seize any available crime profits made by Conway.