It was an audacious double-cross that fooled the Nazis and shortened World War II. Now a document, here published for the first time, reveals the crucial role played by Britain's code-breaking experts in the 1944 invasion of France.

All the ingredients of a gripping spy thriller are there - intrigue, espionage, lies and black propaganda.

An elaborate British wartime plot succeeded in convincing Hitler that the Allies were about to stage the bulk of the D-Day landings in Pas de Calais rather than on the Normandy coast - a diversion that proved crucial in guaranteeing the invasion's success.

An intercepted memo - which has only now come to light - picked up by British agents and decoded by experts at Bletchley Park - the decryption centre depicted in the film Enigma - revealed that German intelligence had fallen for the ruse.

The secrets of Enigma Enigma machine allowed operators to type in message then scramble it

Nazis convinced its code could not be broken, so used it for communications on battlefield, at sea, in sky and within secret services

But it had been cracked - 10,000 code breakers at Bletchley unscrambled top-secret messages using Bombe machine, co-created by Cambridge mathematician Alan Turing More on Enigma Watch an Enigma machine in action

The crucial message was sent after the D-Day landings had started, but let the Allies know the Germans had bought into their deception and believed the main invasion would be near Calais.

It was an insight that saved countless Allied lives and arguably hastened the end of the war.

Now archivists at the site of the code-breaking centre hope that a new project to digitise and put online millions of documents, using equipment donated by electronics company Hewlett-Packard, will uncover further glimpses into its extraordinary past.

Behind the story of this crucial message and its global impact lies Juan Pujol Garcia, an unassuming-looking Spanish businessman who was, in fact, one of the war's most effective double agents.

The Nazis believed Pujol, whom they code named Alaric Arabel, was one of their prize assets, running a network of spies in the UK and feeding crucial information to Berlin via his handler in Madrid.

In fact, the Spaniard was working for British intelligence, who referred to him as Garbo. Almost the entirety of his elaborate web of informants was fictitious and the reports he sent back to Germany were designed, ultimately, to mislead.

But agent Garbo was so completely trusted at the top level of the Nazi high command that he was honoured for his services to Germany, with the approval of Hitler himself, making him one of the few people to be given both the Iron Cross and the MBE for his WWII exploits.

"He was no James Bond - he was a balding, boring, unsmiling little man," says Amyas Godfrey, an associate fellow at the Royal United Services Institute.

"But he had the Germans completely fooled. They thought the information he was sending was so accurate."

To maintain his cover, much of what Garbo fed the Germans was absolutely genuine. But when it came to the looming Allied invasion of France, his "intelligence" was anything but.

Ahead of D-Day, the British launched Operation Fortitude, a plot to confound the Nazis about the location of the landings. Garbo was an integral part of the plan.

To establish his credibility, he sent advance warning ahead of the Normandy landings on 6 June 1944 - but too late for the Germans to act on it.

Then, in the days afterwards, he fed them entirely fictitious intelligence from his fake "agents" that the invasion had been a red herring and "critical attacks" would follow elsewhere - most likely down the coast in Pas de Calais. He also reported, again falsely, that 75 divisions had been massed in England before D-Day, meaning that many more were still to land in France.

It was an account the Nazis took extremely seriously. As can be seen in the document reproduced by the BBC, it was transmitted to their high command by Garbo's German handler.

As a result, German troops were kept in the Calais area in case of an assault, preventing them from offering their fullest possible defence to Normandy.

But what truly gave the Allies the edge was the fact that they knew the Nazis had been duped.

Unknown to Berlin, the Germans' seemingly foolproof Enigma code for secret messages had been cracked by Polish code breakers.

It was like turning up a crock of gold Peter Wescombe, Volunteer, Bletchley Park Bletchley Park's secret archiveBletchley Park texts to go online

In Bletchley Park, Buckinghamshire, some 10,000 men and women were employed deciphering the messages. And when the document above was cracked, the Allies knew they could press forward in the confidence that thousands of German troops would be tied up vainly standing guard at Calais.

"The whole of the 20th Century might have been very different if it wasn't for this," says Kelsey Griffin, Bletchley Park's director of museum operations.

"Churchill's official biographer, Martin Gilbert, said it was difficult to imagine how the D-Day landings could have happened without Bletchley Park.

"We had an army of unarmed intellectuals here."

The intercepted document - in its original, freshly-released, German language version - is all the more extraordinary for having been found by volunteers digging through Bletchley Park's archives.

One of them, retired civil servant Peter Wescombe, 79, recalls the excitement of realising its significance for the first time.

"It was like turning up a crock of gold," he remembers. "It was absolutely wonderful."

It is a find archivists at the site, run by the Bletchley Park Trust, hope will be repeated after HP donated scanners and experts to provide technical expertise to the digitisation project.

Many of the records at the centre have not been touched for years, and the charity hopes that by putting them online in a searchable format they can "crowdsource" the expertise of historians and amateurs alike.

And surely then many more real-life tales of deception, double-crosses and painstaking effort will emerge.