Ian Fleming, author and creator of James Bond, at his desk

The scene: southern Spain. The mission: to stop Franco’s fascists joining the Nazis. The man: Ian Fleming.

Researchers have revealed that the former naval intelligence officer who gave the world James Bond played a critical role in planning the Allied invasion of Spain that never was.

Fleming, who was based in Gibraltar during the Second World War where he monitored Nazi spies in Spain, worked for Real Admiral John Godfrey, director of naval intelligence.

Godfrey is thought to be the basis for M, the spymaster in the Bond novels. Fleming never concealed his admiration for his boss and after Fleming’s death in 1964, Godfrey once complained: “He turned me into that unsavoury character, M.”

The pair enlisted the help of cartography experts to draw maps