AS all of Britain sweated through the hot summer months of 1940 under threat of a Nazi invasion, a Scottish MP, locked in a prison cell, was hoping that German troops would cross the Channel, overwhelm our threadbare army, and set him free.

He was Captain Archibald Henry Maule Ramsay, old Etonian, former officer in the Coldstream Guards, great-nephew of the Earl of Dalhousie and Unionist MP for Peebles and the Southern Division of Midlothian.

He was also an admirer of Hitler's anti-Jewish policies, a rabid anti-Communist who believed the October Revolution was master-minded by Jews and a plotter who had been pleased to recruit William Joyce, the Nazi propaganda broadcaster Lord Haw Haw, as an early member of his own secret society.

Arrested at his home as British troops fell back through France to the beaches at Dunkirk, never tried, not even charged with an offence, Captain Ramsay spent four years in Brixton Prison, vigorously fighting for his freedom.

But without success. He was not released until the Allied armies crossed the Rhine into Germany, all chance of his giving aid to the enemy long gone.

So what had this well connected patriot - for he saw himself as such - done to find himself detained under Defence Regulation 18B, an emergency war-time measure concerned with the defence of the realm.

It was almost certainly the company he kept in those early war months that led to Captain Ramsay spending his war behind bars.

In pursuit of his long established and well known anti-Jewish crusade, the Honourable Member for Peebles formed a secret society, the Right Club.

Numbered among its members, as well as the soon-to-be Lord Haw Haw, were a young cipher clerk, Tyler Kent, employed at the United States Embassy, and Anna Wolkoff, the daughter of a former admiral in the Russian navy . . . and an eager spy.

The confidential de-coding clerk and the emigre Russian were happy to run round blacked-out London with the MP, fly-posting with grotesque anti-Jewish caricatures which Captain Ramsay had specially manufactured. He stored these at home with pamphlets parodying Land of Hope and Glory with the words ''Land of Dope and Jewry, Land That Once Was Free''.

But Tyler and Wolkoff were busy with other activities besides anti-Jewish flyposting. He made copies of messages passing between Churchill and the American president, and passed them to Wolkoff, who put some into code and attempted to send them to Joyce in Germany.

Also, the 40-year-old counted among her contacts an Italian military attache. Soon the German ambassador in Rome was passing information to Berlin ''from an unimpeachable source''.

Kent and Wolkoff were speedily arrested and Captain Ramsay was taken into custody in the early hours five days later. Kent and Wolkoff, tried in camera at the Old Bailey, were jailed for their activities - Kent for seven years, Wolkoff for 10, Captain Ramsay was merely detained.

One of the more bizarre twists in the Ramsay saga grew out of his early determination to have it declared that, as an MP, he was immune from arrest. But the Commons' Committee of Privileges found otherwise, its argument being it was not what Ramsay had said as an MP that had led to his incarceration.

When he did get out of prison towards the end of the war, the die-hard captain quickly returned to his old ways, tabling a motion in the House calling on the Government to reintroduce the Statute of Jewry and enforce its provisions. After which Captain Ramsay faded from the public eye. In 1955 his 40-year struggle against communists and Jews came to an end with his death.