One of the great espionage mysteries has finally been solved - the identity of the real-life inspiration behind M, James Bond's fictional boss.
A new biography, drawing on previously unseen government files, will unmask William Melville as "the Godfather of MI5" and the inspiration for Ian Fleming's M. Like all good spies, Melville carefully hid his true identity. Few outside the world of espionage have ever heard his name. But next month - more than 85 years after his death - Britain's first modern spymaster will get the credit he deserves.
Melville is referred to in the files as M, and it is now being claimed that Fleming used him and his epithet for the character in his James Bond novels. The new book, written by the historian and intelligence expert Andrew Cook, draws on family material from Ireland and New Zealand, along with closed official records, to reveal Melville as the brains behind Britain's embryonic security service.
A master of disguise, the ex-police officer and his team were at the heart of British counter-espionage during the First World War. Melville's exploits, which included enlisting the skills of Harry Houdini to train his operatives, went on to inspire Fleming, who worked for British Intelligence during the Second World War.
"People often discuss who the greatest spies were, but the really great spies are the ones we've never heard of," said Mr Cook. "Melville was one of the most significant espionage operatives of the 20th century. He was the father figure of MI5. A lot of the things he pioneered are still in use today."
In M: MI5's First Spymaster, Mr Cook traces the roots of modern British Intelligence back to a tiny outfit founded by Melville in London's Victoria Street almost exactly 100 years ago.
"When Melville started in 1904, he was effectively posing as a private detective agency under one of his pseudonyms, William Morgan," said Mr Cook. "Even then, he was acting as a focus for dealing with, and recruiting against, the German espionage network. In 1909, the organisation became the Secret Service Bureau."
From as early as 1904, Melville was known simply by his initial in official documents, an idea that caught Fleming's imagination.
"Melville was referred to by the War Office as M or the Spymaster from almost the beginning," said Mr Cook. "We know for a fact that Fleming was like a sponge during the Second World War, soaking up stories about individuals. He was particularly taken by Melville."
Unlike his office-bound namesake, the real M was also an active field operative. "Melville was a master of disguise," said Mr Cook. "One of his favourite tricks was to gain access to an address by posing as a sanitary inspector."
In 1914, Melville, who had previously headed Scotland Yard and worked on the Jack the Ripper case, founded a secret "spy school" in Whitehall for British operatives.
Fleming's M has always been a popular figure with 007 fans. For the first 11 Bond films, M was immortalised by Bernard Lee, who died in 1981. In 1995, M became a woman, acted by Dame Judi Dench and reflecting the appointment of Dame Stella Rimington as the head of MI5 in 1992.
The book, to be published by Tempus at the end of October, is likely to provoke debate. Former Conservative MP and MI5 historian Rupert Allason said: "The connection with Harry Houdini in particular is absolutely splendid. But I don't believe Fleming ever would have seen Melville's files."