As the Blitz raged overhead during the winter of 1940, a former member of the Home Guard, 40-year-old Gilbert Roberts, joined the hundreds of people sheltering in one of London's busiest Underground stations.

On the streets above, Christmas had been cancelled: twinkling lights and festive displays were thought to give the Luftwaffe's pilots way too easy a target.

Instead, a dozen or so small decorated fir trees had been arranged along the subterranean platform at South Kensington Tube station.

The newly revived Women's Royal Naval Service, or Wrens, work on the strategy to foil raids by German U-boats

As Roberts stood admiring them, he noticed a man who seemed familiar. He was wearing plain clothes and a cap, and carrying a stick. He, too, was looking at the trees.

After some moments, the stranger approached the uniformed Roberts and asked him if he would be kind enough to accompany him back to ground level. The blood drained from the military man's face as he realised who he was talking to.

At the base of the steps the man was recognised by others, too. 'There were no cheers,' Roberts later wrote. 'But they bowed as he climbed up the middle row of stairs [while] saying, 'Happy Christmas, Your Majesty.' '

Outside, George VI shook hands with Roberts, then climbed into a grey Hillman car and drove away.

It was an extraordinary encounter – but for Roberts it would not be his last with the monarch. Their next meeting would, however, happen in very different circumstances.

By the time the two men's paths crossed again two years later, Roberts, a former commander and military strategist who had been invalided out of the Navy in 1937 after a severe bout of tuberculosis, would be masterminding one of the Second World War's most audacious maritime operations.

And the King would be relying on Roberts and his team of unlikely helpers – a group of inexperienced young women barely out of school – to rescue a nation at risk of being starved into surrender.

Gilbert Roberts (left) explains his findings to a senior naval officer. Roberts was a highly experienced navigational strategist and commander

By the autumn of 1941, the menace of German U-boats was devastating the British war effort. Operating in groups known as 'wolf packs' – inspired by the indigenous hunters of their homeland – they had torpedoed and sunk countless convoys packed with vital supplies. A chart at the Admiralty showing losses in the Atlantic loomed like a calendar outlining the schedule of a death sentence.

Throughout 1941, Allied shipping losses had steadily increased from 2.5 million tons in January to an average of four million tons of food, fuel and building materials a month by the autumn.

Successively, meat, tea, jam, biscuits, breakfast cereals, cheese, eggs, lard, milk, canned and dried fruit were subject to rationing. Government scientists developed techniques to spray-dry eggs, converting them into a powder that took up just 20 per cent of the shipping space required for fresh eggs. Powders and pastes were designed to approximate scarce or vanished foodstuffs such as bananas and cheese.

On June 1, 1941, clothing was rationed, and a year later petrol was available only to official users, such as the emergency services.

Naval commanders frantically turned their attention to the training of escort ships. The majority of the 1,300 merchant ships sunk in 1941 were attributed to U-boats and, in comparison, the Allied score looked pitiful: just 12 U-boats were sunk in the first half of the year, with none at all in January, February or July.

But lacking a coherent set of effective tactics, the escort ships remained woefully unprepared for encounters with enemy submarines at sea. The Battle of the Atlantic was being lost.

At a tactical course, commanding and other officers of British and Allied escort vessels 'played games' which enabled them to combat the U-boat menace

Winston Churchill, who later wrote that the U-boat terror was 'the only thing that ever really frightened me', held an emergency meeting. Finding an effective plan to counter the underwater enemy had become a life-and-death issue.

The man chosen to try to overcome the threat was Gilbert Roberts: clubbable, charismatic and, until his career was cut brutally short by illness, a highly experienced navigational strategist and commander. Roberts had been devastated by the loss of his career and throughout the early years of the conflict had applied repeatedly for war work. He had, however, received multiple rejections.

Then, out of the blue, he received a phone call summoning him to the Cabinet Office. There he was ordered to report for duty in Liverpool as head of a new department to be known as the Western Approaches Tactical Unit (WATU). The brief was to the point. 'Find out what is happening and sink the U-boats,' Churchill told him.

For Roberts, the chance of rehabilitation, and at such a level, was an extraordinary one. Indeed, so overwhelmed with excitement was he that he almost missed his train to Liverpool.

Roberts arrived in the city in the early hours of January 2, 1942, with a plan already forming in his mind. The following morning he met his commander, Sir Percy Noble.

His intention, he told Noble, was to develop a kind of war game that would enable the British to understand why the U-boats were proving so successful, and help develop counter-tactics.

The game – something along the lines of the modern Battleships or Risk – would then become the basis for a training centre for military personnel. Noble did little to hide his disdain for the plan. 'Well,' Roberts remembered his new boss saying, 'you can carry on, but don't bother me with it.'

By the autumn of 1941, the menace of German U-boats (pictured) was devastating the British war effort

Still stinging from this remark, Roberts returned to his office in the building which was to be his home for the rest of the war: WATU's headquarters at Derby House, next to Liverpool Town Hall. There he set to work.

Using the floor as a giant board, and with the help of pieces of chalk and lengths of string, he designed a team game that imitated a wolf-pack attack on a convoy in the Atlantic. One team would take the role of the commanders of escort ships, while the other acted as U-boat captains.

Known or suspected locations of enemy craft at sea would be provided by decoders at Bletchley Park and elsewhere, and live information would be fed into the game. The teams would then take it in turns to make their moves.

The game was prepared, but there now remained the question of recruits willing and able to help him. These would be, he had been told, former Navy personnel deemed unfit for active duty, supplemented by volunteers from the newly revived Women's Royal Naval Service, or Wrens.

The early signs were not auspicious. To his dismay, Roberts's first two male colleagues proved to be 'dull of brain'. He could only hope that the Wrens would make up the considerable shortfall.

A0 Wren climbs a ladder to make an alteration to an indicator on one of the large, wall mounted maps

He would not be disappointed. By the end of the week, four whip-smart young women were at his side to work as plotters, with six junior Wrens selected to handle the administrative side of the game. Not one of them knew anything about military strategy, but all were fired with enthusiasm for the task.

It was the start of an astonishing collaboration between a former sailor still struggling with ill-health and a group of inexperienced women, some still in their teens, that would go on to turn the tide of the Second World War.

The Wrens learned quickly. Working in gruelling ten-hour shifts, they provided round-the-clock cover which left them little time for rest.

'During these watches we had time off for meals, and a bit of a snooze at night if we were lucky,' recalls former Derby House plotter Mary Hall.

Indeed, so long were their hours that a sun-ray treatment room was installed to compensate for the time they spent underground.

As the games got under way, a question began forming in Roberts's mind. If the deadly U-boats were firing from outside the convoys of Allied ships, as had always been assumed by top brass, how had the enemy recently succeeded in sinking a merchant vessel right at the centre of the group?

Could it be that the British tactics so far had been based on completely wrong information?

Roberts (centre) was a former commander and military strategist who had been invalided out of the Navy in 1937 after a severe bout of tuberculosis

The Navy's current strategy was for escort ships to turn away from the main convoy on the sound of an alarm, and fire depth charges in a direction away from the principal vessels. But supposing, wondered Roberts, the U-boats had, in fact, attacked from deep inside the columns of the convoy? And if so, how had they got there?

It was late at night, but he asked two of the Wrens, 21-year-old Jean Laidlaw and Janet Okell, 19, if they would stay behind and run a new game on the board.

Infused with Roberts's excitement, the two women hastily set up the game, plotting different scenarios that might have enabled a U-boat to sneak into the convoy undetected.

Eventually, they concluded that the enemy submarines must have approached on the surface at night from the rear, where the lookouts rarely checked. They would then have been able to slip inside the convoy, torpedo the vessel at close range and quickly dive to avoid detection. Only when the convoy had safely passed overhead would they have escaped.

With a mounting sense of excitement, the group began working on a counter-strategy. After a late-night supper of corned-beef sandwiches and coffee, Jean and Janet were on their hands and knees on the floor again.

They lined the model escort ships up around the merchant craft and then, while the convoy continued on its way, each escort ship remained to perform a sweep, listening for the U-boats lurking beneath and dropping depth charges to destroy them.

The scenario was replayed the next day again and again. Roberts's bold new system entirely upended the current military thinking. Instead of firing at German submarines away from the convoys, the enemy would be attacked from within.

'I couldn't pick a hole in it anywhere,' wrote Roberts in his diary. He sent a message that he would like to see Sir Percy Noble as soon as possible.

Roberts arrived in the city in the early hours of January 2, 1942, with a plan already forming in his mind. The following morning he met his commander, Sir Percy Noble (centre)

The next day, Noble, flanked by his senior staff, entered the games room. Warily, the commander-in- chief eyed the markings on the floor. How could Roberts, with his stubs of chalk and jumbled string, contribute anything to the life-and-death battles being waged out at sea?

Undeterred, Roberts explained their new theory. As Jean and Janet began to play out the scene, Noble's demeanour changed – he and his staff seeming to 'sit forward on their chairs', as Roberts later reported. When the demonstration ended, Noble had only one word to say to the group: 'Congratulations.'

The commander-in-chief then turned to one of his men and told him to take down a message to be sent post haste to the Prime Minister. 'The first investigations have shown a cardinal error in U-boat tactics,' he said.

'A new, immediate and concerted counter-attack will be signalled to the fleet within 24 hours.'

An air of friendship, Roberts noted, had arrived in the room. Noble now asked for a name for the tactic from the inventor. Roberts explained that Jean Laidlaw, who had 'done all the boring statistics' had christened it Raspberry. The manoeuvre was, she reasoned, a 'razz' of contempt aimed at Hitler and his submarines.

Noble chuckled. As he left he paused and turned to Roberts. 'Sew on your fourth stripe,' he said. The commander was now a captain.

Operation Raspberry would prove its worth over and over again. Just weeks after its implementation, escort ships sank four times as many German U-boats as they had in the previous month – an upward trend that would continue for the rest of the year. Later, the young strategists would add Gooseberry, Pineapple, Strawberry and Artichoke to their repertoire of manoeuvres. Unlike Raspberry, many of these gave escort ships the tactics needed to hunt U-boats before they made an attack.

No time had been wasted. In February 1942, the first group of naval officers arrived fresh from the ocean to begin a week-long training course using Roberts's game.

As news of its successes spread, the unit began attracting high-profile visitors including, in November, the King and Queen. On the morning of the visit, the Wrens were, as Roberts later recalled, 'all of a twitter'. Despite the pressure, however, they performed their Raspberry manoeuvre to perfection.

Afterwards the King, who recognised Roberts from their meeting two years earlier, asked about his health and admonished him for getting too thin – Roberts by this stage weighed little more than 8st.

Finally, King George gestured at the floor, still littered with the remnants of the game. 'This,' he said, leaning into Roberts, 'is the key to the Battle of the Atlantic.'

By the end of 1942, as many as 200 naval officers a month were playing the game, among them the ornithologist Peter Scott, remembered by one of the Wrens for drawing ducks all over his navigational chart. And there was a young Prince Philip, future husband to Queen Elizabeth.

The dashing prince's presence around the unit brought many of the Wrens 'unending delight', as one put it. Another notable trainee was the writer Nicholas Monsarrat, who would go on to describe in his 1951 novel The Cruel Sea a 'convoy game' played out with model ships on the floor of an empty room that was clearly based on his WATU experience.

The turning point in the Battle of the Atlantic finally came in May 1943. After a week of bitter fighting, and following heavy losses on both sides, German U-boat chief Karl Dönitz withdrew his remaining submarines.

It was a triumph of strategic brilliance. But for Roberts there was to be no formal recognition. On January 4, 1965, he received a letter telling him that he was to receive a knighthood. It was a gesture that vindicated his work and promised to erase, finally, the scar he still bore from his dismissal from the Navy so many years earlier.

But the following day the phone rang. The letter, the caller explained, had been sent in error – the invitation was retracted.

'Why didn't they just let him have it anyway?' says his daughter Susan.

Why indeed?

It was a cruelty, she said, from which her father never recovered. Roberts died in January 1986 feeling that his role in the fight against the Nazi threat had never been fully recognised. The women, too, received no accolade. And yet for many of them, the long-term rewards may well have been a compensation.

'It gave me my first taste of freedom,' wrote one. 'Before the Wrens, I'd had to account for everything – where I was going, who with, and what time I'd be home. You didn't really think about it until you had the chance to be freer.'

Forbidden to talk about it for 50 years, many of the surviving Wrens have described how they never even told their husbands what they had done during the war.

Only now, following the release of archive material and conversations with some of the remarkable women involved, can Britain's debt to these unsung heroines and their brilliant leader Gilbert Roberts be finally and fully acknowledged.

© Simon Parkin, 2019