Sam Mendes’s epic new First World War film 1917 is based on the stories of his grandfather Alfred Mendes, who fought on the Western Front between 1916-18.

Born in Trinidad, Alfie Mendes signed up at the age of 19, trained as a signaller, fought at Passchendaele and was awarded the Military Medal for helping to rescue comrades left stranded in no man’s land.

Alfred was undoubtedly a brave soldier who witnessed appalling things. He was also a novelist and poet, with an extravagant imagination.

The tale told in 1917 is a very tall story indeed.

The plot of the film revolves around an apparently hopeless mission, with strong echoes of Saving Private Ryan. The Germans have withdrawn to a new defensive position, the Hindenburg Line, but it involves a trap.

Farther up the line from headquarters, the commander of the 2nd Battalion of the Devonshire Regiment (played by Benedict Cumberbatch) believes that this is a genuine retreat and is about to send 1,600 men over the top to almost certain death. Two soldiers, played by George MacKay (Lance Corporal Schofield) and Dean-Charles Chapman (Lance Corporal Blake), are sent to cross what was no man’s land and the area formerly occupied by the Germans to warn the Devonshires before they charge into the ambush.

The tale told in 1917 is a very tall story indeed.

It is a terrific plot line, but it did not happen. For one thing, it was easy to pass messages from one sector of the British line to another. The trenches were crowded, but not impassable. The trench line was contiguous, that was the point. You sent a runner along the trenches.

Then there were field telephones connecting the front line to the rear. The film refers to these having been cut, but since they were behind the lines this seems highly unlikely. And laying new field telephone lines was comparatively simple, even in the chaos of war.

The British had been carrying out aerial reconnaissance for months and knew that the Germans were preparing to retreat to the new line in the spring of 1917. If this had been merely a ruse they would have been able to warn commanders well in advance. Western Front manoeuvres were glacially slow. The German retreat actually took more than a month; in the film the messengers have just a few hours to save the Devonshires.

At one point the movie undermines its own plot. Having struggled across the abandoned and booby-trapped German trenches Schofield is picked up by a British contingent (under the command of Captain Smith, brilliantly played by Mark Strong) heading to the new front line. If it was that easy to get across, why did the messengers not simply hitch a lift with advancing troops in the first place?

The plot of the film revolves around an apparently hopeless mission, with strong echoes of Saving Private Ryan.

That’s enough quibbling. All great war films, from All Quiet on the Western Front to The Longest Day, finally depend not on strict factual accuracy but emotional truth, and in this 1917 succeeds magnificently; the boredom, dirt, confusion, terror, noise, rat-infested human remains and utter pointlessness of the war on the Western Front are captured superbly in what is made to seem like one long, miasmic cinematic take.

No one, including the commanders, really knew what was happening on the battlefield at any given moment. The war was at once brutally intimate and immediate, and insanely vague. Soldiers kept getting lost. Many participants recall the experience as a long, confusing nightmare, interrupted by moments of sheer terror. That is what 1917, and that war, are about.

Sam Mendes’s film pivots on a crucial and genuine moment in the course of the war. But more than that, his grandfather’s story, expanded and embellished, offers a reflection on the nature of human memory and the way that we deploy narrative to understand the past.

In one extraordinary scene, George MacKay comes across a young woman with a newborn baby in the basement of an abandoned building.

Between February 9 and March 20, 1917 the German army undertook Operation Alberich, a strategic withdrawal to the preconstructed Hindenburg Line, eliminating two salients formed during the Battle of the Somme and making the front shorter and easier to defend. The Germans were outnumbered and the move cut more than 25 miles out of the front line, freeing up 13 German divisions to fight elsewhere.

The Germans instituted a “scorched earth” policy in the abandoned territory, cutting down trees, destroying roads and railway lines, poisoning water supplies and killing livestock. They left a land sown with landmines and bunkers riddled with explosives to delay the advancing Allies.

All great war films, from All Quiet on the Western Front to The Longest Day, finally depend not on strict factual accuracy but emotional truth, and in this 1917 succeeds magnificently.

The film depicts the awed shock of the two soldiers on entering an abandoned German bunker, luxurious in comparison to the British dugouts. This is accurate: German military engineers took enormous pride in their defensive constructions, some of them several storeys deep with built-in sewerage and kitchens, more like underground hotels than defensive fortifications.

When they retired, German sappers packed them with booby-traps. The Great War is often depicted as gentlemanly — it was anything but, as correctly shown in the most dramatic moment of 1917, when the soldiers save the life of a downed German pilot, only to be attacked by him.

One of the most extraordinary moments of the film is actually quite plausible. At one point, in the basement of an abandoned building, Schofield comes across a young woman with a newborn baby and gives them his meagre rations. This may look like a rather forced attempt to crowbar a woman into an all-male story. In fact, while about 125,000 able-bodied French civilians were forcibly transported from the area to work elsewhere in occupied France, mothers, children and the elderly were left behind with minimal food and water.

The grisly fate of the French under German occupation is one of the forgotten tragedies of the First World War. After it was over they were often unfairly accused of collaboration, dismissed as “les Boches du nord”, the Germans of the north.

At a stroke Operation Alberich gave up more French territory than the Allies had gained since the start of the war, but it was a German strategic success, freeing up much-needed manpower, disrupting Allied plans for a spring offensive and arguably extending the war.

The Great War is often depicted as gentlemanly — it was anything but, as correctly shown in the most dramatic moment of 1917.

The new defensive line was built on a reverse slope, with massive concrete fortifications that were far harder to attack than the abandoned positions on flatter ground. It was finally broken in September 1918 during the Hundred Days Offensive.

However, the staged withdrawal was a propaganda disaster and was widely denounced as a war crime. The advancing British were able to publish photographs of French farmland destroyed by the withdrawing German troops, a place of torched buildings, tree stumps and bloated animal carcasses. Crown Prince Rupprecht of Bavaria, commander of the German armies from the Somme to the North Sea, had strongly objected to the devastation of the scorched earth policy, but was overruled.

The film depicts the imaginary attack by the Devonshires as a potential disaster. It was actually rather a good idea. The French commander of the Northern Army Group, General Louis Franchet d’Espèrey (who physically resembled a howitzer shell, according to one contemporary, and tended to clear roadblocks by firing his revolver), advocated launching an all-out assault while the Germans were heading backwards. If it had succeeded, this might have changed the course of the war and saved thousands of lives lost in the final two years of fighting.

Top: soldiers in World War I. Above: Dean-Charles Chapman and George MacKay on the set of 1917.

The opportunity was missed. The Germans carried out an orderly withdrawal, with minimal losses, behind rearguard lines of machinegunners. The British cautiously moved up into the unoccupied positions. The war of stalemate resumed.

Six months later Alfred Mendes of the 1st Battalion Rifle Brigade was among the men sent to retake the village of Poelcappelle, close to the Passchendaele Ridge. Of the 484 men in his battalion 158 were killed, wounded or unaccounted for, left scattered across a wide expanse of mud-filled shell craters. The battalion asked for volunteers to go out to identify their positions. “I felt myself under an obligation to the battalion,” Alfred later wrote.

He crawled into the man-made horror of no man’s land. “In spite of the snipers, the machinegunners and the shells, I arrived back at C Company’s shell hole without a scratch, but with a series of hair-raising experiences that would keep my grand and great-grandchildren enthralled for nights on end.”

One of the most extraordinary moments of the film is actually quite plausible.

Most veterans of the First World War seldom spoke of the truly ghastly experience of trench warfare, preferring to remember in a series of snapshots, seldom heroic, frequently humorous.

Alfred was the same, telling his grandchildren of the German soldier who kept running after his head was blown off, and the wounded soldier Alfred brought back to the lines over his shoulder, only to discover that he was dead, killed by a bullet that would otherwise have killed Alfred.

Alfred’s grandson Sam remembered a snippet of a story about a messenger trying to get through, and decades later expanded it into a two-hour film.

In later life Alfred washed his hands compulsively, as if trying to expunge the memory-mud of the Somme. He moved to New York and in 1934 wrote his first novel, which had an introduction by Aldous Huxley. Alfred mixed with such literary luminaries as William Faulkner, Thomas Wolfe and William Saroyan.

Alfie Mendes may have embroidered his wartime stories for his grandchildren. One of these has enlarged and reimagined those fragments into a gripping movie depicting an event that did not happen. But this is not untruth — it is the way memory, history and art work together. Fiction and film are the way we interpret events emotionally, true to the spirit of the past, without necessarily being enslaved to strict historical accuracy.

All historical films must strike a balance between factual precision and an imaginary dramatised past. Some get it hopelessly wrong. The 2000 film U-571 depicted the capture of the Enigma machine by American naval forces, when British sailors had actually achieved this months before the US entered the Second World War. Others, such as The Imitation Game about Bletchley Park, skilfully use artistic licence to tell a story that might otherwise depict a lot of people doing maths calculations while sitting in wooden huts.

Sam Mendes has described how, when he was 12, his grandfather gave him a handwritten “contract” in which the boy promised to write his first novel by the age of 18. “He told me, ‘You’re going to tell stories. This is what you have to do.’ ”

This account of the intergenerational contract, binding one future storyteller to another, itself sounds like storytelling. It may or may not be exactly true. It doesn’t much matter. It’s a great story.