The National Library of Scotland has admitted falling victim to a "sophisticated and complex" crime after one of its managers embezzled £500,000.
IT boss David Dinham, 33, stole the money over a four-year period from 2006 when he had control over huge budgets at the historic institution.
Dinham, from Edinburgh, admitted the embezzlement charge at a hearing at Edinburgh Sheriff Court last week.
He is due to be sentenced on 21 June once background reports are compiled.
The offence took place between 6 September 2006 and 9 June 2010.
Martyn Wade, chief executive of the National Library of Scotland (NLS), said: "This was a complex and sophisticated crime committed by a senior manager and budget holder who had a detailed knowledge of internal processes and procedures.
"Our systems identified discrepancies and as soon as these were confirmed, appropriate action was taken and the police were notified.
"Internal procedures were immediately reviewed and strengthened.
"A planned upgrade to a new financial system has recently been completed, which should prevent any future misappropriation of this kind."
He added: "To date over £146,000 of stolen funds has been recovered and the National Library of Scotland is continuing legal proceedings to recover as many funds as possible."
It is understood NLS staff spotted financial irregularities and called in the police.
In his role, Dinham was understood to have been in charge of a £1.8m project to store the library's digital archive.
Founded in 1689 as the library for the Faculty of Advocates, the NLS holds almost 400 years worth of Scotland's written history and culture.