A book detailing the first 40 years of the UK's foreign intelligence service has been published.
Author Professor Keith Jeffery was given access to the archives at MI6, which has the official title of the Secret Intelligence Service.
Prof Jeffery said that in researching MI6: The History of the Secret Intelligence Service 1909-1949 he was allowed to view all files.
He said his only restriction was not to name some traitorous agents.
Among the controversial files he was able to study was an account of MI6 agents sabotaging ships due to carry Jewish refuges to the then British Mandate of Palestine, immediately following the end of World War II.
Prof Jeffery, from Queen's University in Belfast, said his research uncovered MI6 failures as well as successes.
He added: "[MI6] had a really bad start to the war but then so did every other part of the British machine, except perhaps the air force.
"But, like the rest of the British war effort, it builds on its successes throughout occupied Europe and across the world where German intelligence was ruled up by MI6 successes."
Prof Jeffery - the first historian to be allowed access to the archive - told BBC security correspondent Gordon Corera it was a fascinating experience to examine the accounts of the real people involved with MI6.
He said: "This archive is the holy grail of British archives - it is closed tight to everyone, so when I got in there, I was like a child in a sweet shop.
"It was a cornucopia, an extraordinary Aladdin's cave of historical materials.
"It's very patchy - quite a lot of stuff has been destroyed over the years. It hasn't all survived but there are enough files there to tell the stories of the real people at the real sharp end doing real brave stuff.
"The reality is actually more difficult than the fiction. Because you're dealing with real people, you realise that they have their weaknesses and their strengths."
The book tells the story of one of MI6's more controversial operations - the aptly titled Operation Embarrass, which agents launched just after World War II.
MI6 aimed to blow up ships in port preparing to take Jewish refugees to Palestine. At the time, Britain was still ruling Palestine and politicians ordered the service to stop the flow of refugees.
Prof Jeffery also unearthed the case of an agent code named TR16 who worked for the secret service during World War I and provided naval intelligence from within Germany.
Prof Jeffery said: "[TR16] runs right through to the eve of the Second World War - he's over 60, he's running out of steam and he wants to retire.
"The signals tell us that he suddenly doesn't turn up for meeting. It doesn't tell us what happens to him.
"All we've got is a 'presumed dead' in a file and that's an extraordinary moment when you hit a file like that."
He said he could not give the real names of the agents involved, because they had agreed to do their jobs in the knowledge their names would never be revealed.
"When I started, I wanted to tell everything. I'm a historian and my job is to reveal secrets. [MI6's] job is keeping secrets, so there is always going to be a tension," he said.
Prof Jeffery said he was thankful he had to stop his research in 1949, just as the Cold War was beginning, and MI6's greatest traitor, Kim Philby, was rising through the organisation's ranks.
"I fell down on my knees and thanked the Lord I was stopping at 1949. [The book is] 800 pages long and packing in even that period in is enough. There's still a lot of it skimmed over and we're summarising a lot.
"Yes, there's lots more exciting stuff to be done in the future but that's for my successor - if there is one."
Intelligence analyst Glenmore Trenear-Harvey praised Prof Jeffery's efforts but questioned why the account had to stop in 1949.
He told the BBC: "It is a masterly work. Full congratulations to him for covering the period that he did, but it is like hearing about my grandparents when I want to hear about the scandalous things within my recent family. That is missing."
"Even in the National Archive we can access more recent and up to date information. It is out there. This book is long overdue, but it is 50 years out of date."
Last year saw the publication of the first authorised history of MI5 - the secret service division that focuses on gathering intelligence in the UK.
The Defence of the Realm: The Authorized History of MI5 by historian Christopher Andrew also used the organisation's own secret records to tell its story from 1909 to the present day.
Revelations included the fact that MI5 infiltrated the Communist Party of Great Britain in the 1950s, using hidden microphones and covert methods to gain membership records; a number of union leaders and MPs worked for Soviet bloc intelligence agencies; and British politicians urged MI5 to spy on industrial and political opponents on many occasions.
MI6: The History of the Secret Intelligence Service 1909-1949 is published on Tuesday.