Fear of an enemy within has become a defining aspect of modern history. Britain, having “stood alone” against Hitler, took pride in its defiance of fascism – after the internment of Oswald Mosley and his goons it was assumed that the country was safe from the Nazi contagion. But following the release of declassified MI5 files in 2014 that assumption collapsed, for in them was revealed an enemy hiding in plain sight. Some were Germans domiciled in Britain, but most were ordinary British citizens willing to help and even risk their lives for the Nazi cause.

Robert Hutton’s deeply researched, often astounding book describes how a loose network of homegrown fascists plotted to undermine wartime Britain, and explains the ingenious way MI5 attempted to neutralise them. It places centre-stage an unlikely hero, a balding ex-bank clerk from Cornwall named Eric Roberts, first recruited by the spymaster Maxwell Knight to infiltrate a British Union of Fascists cell in 1930s Leeds. Equipped with a winning smile and an extraordinary amount of nerve, Roberts rose through the ranks until he caught the eye of Victor Rothschild, heir to the banking fortune, head of MI5’s anti-sabotage unit and a dab hand at bomb disposal. As the war intensified, Rothschild and his lieutenant, Theresa Clay, decided that the best way to control British subversives would be to set up a fifth column, and in 1942 they appointed Roberts, under the nom de guerre “Jack King”, as their controller.

Masquerading as the Gestapo’s man in London, Jack offered an apparently sympathetic ear to men and women driven by a virulent antisemitism and a conviction that Hitler was the future of Europe. Hutton includes transcripts of eavesdropped conversations with these fanatics that would make your hair stand on end. Some of them were mere cranks and fantasists, but others were diligent gatherers of intelligence – about airfields, petrol dumps, camouflaged factories – that might have endangered the country had it ended up in Berlin. Take Nancy Brown, a young woman who monitored the home defences in Hastings and was thrilled to tell Jack of a Luftwaffe air raid that destroyed a school clinic, killing a clerk, a pregnant mother and two children. “It was obvious the deaths of these people meant absolutely nothing to her,” Roberts later reported.

Unlikely hero … Eric Roberts. Photograph: National Archives/Associated Press

As in any good spy yarn the hero had one arch-adversary to battle with. Marita Perigoe, a leading light of the British Fascists in the 30s, was a “crafty and dangerous” woman who became the fifth column’s recruiting officer. She and Jack would meet in a Paddington safe house to plan their latest sedition, though Marita always suspected – with good reason – that her “Gestapo” handler was a covert MI5 operative, and would search their meeting place for bugs. (They were right in front of her – inside the telephone.) More than once she talked about killing him. Jack paid Marita a weekly stipend of £4, and she furnished a supply of intelligence and contacts that kept MI5 busy for the rest of the war. The fifth column’s other star spy was an Austrian, Hans Kohout, who winkled out top-secret information on a new de Havilland fighter-bomber; he also got wind of a prototype anti-radar system known as “Window” when the Air Ministry approached his company to manufacture aluminium strips. Most alarming was Kohout’s stumbling on one of Britain’s greatest wartime secrets: through a contact he learned of a country house being run as an intelligence HQ. Its name – Bletchley Park. Roberts was quickly deputed to tell him that operations at Bletchley were “of no interest” to the Gestapo.

This is the wonder – and the horror – of the story Hutton tells. That there were all sorts of inconspicuous but resourceful British natives plotting to bring down Churchill’s government is frightening enough; that they might have succeeded in communicating vital secrets to Berlin hardly bears thinking about. You marvel at their being taken in by “Jack King”, but also at Roberts’s cunning and bravery in sustaining the imposture for three years; one false move might have given the game away, and there would have been plenty among his duped legions ready to take revenge.

Nor were they brought to book at the end of the war. For one thing, prosecution would have been difficult – the safe house recordings were not admissible as evidence – and for another, it would have driven the fascist movement underground. Marita and co went to their graves believing that they had done their bit to help the Fatherland. Roberts’s bosses argued over rewarding him. Rothschild suggested a year’s salary and an MBE, but neither materialised. His work remained officially unacknowledged, partly for security reasons and partly through MI5’s embarrassment at the methods they had used in containing the fifth column. Roberts eventually retired to Canada with his wife and children. For decades his name was unknown to the public. Agent Jack has paid him a belated and honourable due.

• Our Friends in Berlin by Anthony Quinn is published by Cape. Agent Jack is published by Weidenfeld & Nicolson. To order a copy for £17 (RRP £20) go to guardianbookshop.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99.