MI5, our domestic security service, takes pride in its history, and particularly in some of its early successes. Its website, for example, devotes a whole page to "the great spy round-up" at the start of the First World War, when 21 out of the 22 German spies operating in Britain were arrested in dawn raids.
This was, most history books agree, a stunning coup. As the website puts it: "The arrests wrecked German efforts to establish a regular stream of intelligence from Britain, just at the moment when it was most needed."
Not quite, it seems. New research using MI5 documents released to the National Archives at Kew tells a rather different story, and it is one that may be familiar today, after the Blair government's use of secret intelligence to justify its desire to go to war in Iraq.
Back in 1914, as war approached, the press was convinced that the Asquith government was sitting on its hands while armies of German spies insinuated themselves into British life. The Daily Mail, for example, lambasted ministers while telling readers to take matters into their own hands: "Refuse to be served by a German waiter. If he says he is Swiss, demand to see his passport."
Reginald McKenna, the home secretary, desperate to show that the government was on the case, decided to bring in the Aliens Restriction Act, but to get it past MPs he needed proof that there really was a spy threat.
Just as, nearly a century later, Blair was to find a helpful friend in Sir Richard Dearlove, the head of MI6, so McKenna relied on Vernon Kell, the first head of MI5. Briefed by Kell, the minister rose in the Commons on 5 August 1914, the day after war was declared, to announce: "Within the last 24 hours, no fewer than 21 spies or suspected spies have been arrested, some of them long known to the authorities."
With MPs immediately baying for the arrested spies to be hanged or shot, the government had precisely the right environment to pass its new restrictions on foreigners. But things were not as they seemed. According to research by one of Britain's foremost intelligence historians, McKenna's announcement was "a deliberate lie".
By careful analysis of MI5 documents and Kell's personal papers, Nick Hiley at the University of Kent has discovered that the list of 21 spies given in MI5's official history was actually drawn up after the announcement. Most of those named were not even in custody at the time of McKenna's claim, and the great majority turned out to be entirely innocent.
What had happened was that the Daily Express, eager to follow up the story, asked for more details of the spy swoop, and the rest of the press joined in the call. This raised a difficulty for McKenna, and therefore for Kell, because most of the 21 spies did not exist. There followed, as Hiley puts it, "a desperate trawling of police reports".
To be fair to MI5, it had in fact been doing its job, catching 11 real German spies in the period before war began, and on the outbreak of hostilities it picked up Berlin's main agent in Britain, an Islington hairdresser called Karl Gustav Ernst.
Bizarrely, however, Ernst wasn't on the list of 21 names thrown together after McKenna's dramatic announcement, while half of the arrests that were listed had nothing to do with MI5. They included Karl Stubenwoll, an Austrian caught in possession of ship diagrams. Though it turned out he was a naval architect working legitimately for a Newcastle shipyard, he was quietly deported. The same fate befell Kurd von Weller, a retired German army officer living quietly in Cornwall who made the mistake of reporting to his local police station at the outbreak of hostilities.
A third man on the list, Max Laurens, was indeed a spy, having previously spied on the Germans for the British. When war broke out he offered to resume this service and was astonished to find himself under arrest, though fortunately MI6 stepped in and had him freed. He later went on spying missions into German-occupied territory.
In Hiley's view Vernon Kell initially saw the list as meaningless, and his actions were underpinned by the belief, shared with readers of the Mail and the Express, that there were thousands of German spies in Britain. In fact, Hiley says, this was nothing more than a fantasy.
Michael Smith is defence correspondent of the Sunday Times