Wistful yet anthemic, a 19th-century hymn sets the scene for the stage production of War Horse.

The Songman sings it first, but then the entire company - some three dozen strong - joins in, swelling the evocative chorus of Only Remembered For What We Have Done with its haunting acknowledgement of those who "faded away like the stars of the morning..." Sankey's setting of lyrics by Dr Horatius Bonar dates back to 1891, a period between the two Boer Wars, but its sentiments are timeless, and especially apposite now.

This year marks the centenary of the outbreak of the First World War, tagged "the war to end all wars" but, as subsequent conflicts continue to prove, that label was a forlorn hope. Passing decades, and the dwindling numbers of World War One veterans, began nudging memories of the 1914-18 years into a kind of sepia-tinged chapter of long-ago events.

The statistics stayed unmoved, forever stark and horrifying: an estimated 10 million people died, while the landscape of Europe was ravaged by shelling, trenches and troop movements. Yes, there was some film footage, official documentation and the intense witnessing of carnage by poets such as Wilfred Owen and Siegfried Sassoon to act as aide-memoirs. But the flesh-and-blood reality of warfare, the first-person accounts told by those who had been there, were an increasing rarity.

In the winter of 1980, however, the writer Michael Morpurgo came face to face with a survivor of those battlefields. Even now, he vividly recalls sitting in front of a log fire in the Duke of York pub in Iddesleigh, a small village in Devon where he and his wife Clare had made their home.

"I was having a conversation with an old soldier from the First World War," he says, "a chap called Wilf Ellis, and he suddenly started telling me about what it was like to be in the trenches of Flanders fields. It was if he was actually back there, seeing it all again. He'd never forgotten any of it. He'd lived with it ever since. His wife would later tell me that Wilf had never spoken about his experiences to her, or indeed to anyone. Who knows why he decided to tell me, a relative stranger, about what he'd seen and what it had felt like to be under fire, see comrades killed ... And that, really, was the beginning of me writing War Horse."

It transpired that there were other old men living in the area who not only shared Wilf's memories but had poignant recollections of their own experiences as cavalrymen - and of the horses who had been shipped over to France, never to come back. Listening, Morpurgo heard of a special camaraderie that touched him with an unexpected and immediate poignancy. Because of his charity, Farms For City Children - which he and his wife set up in 1976 - Morpurgo was already aware of the bond that can exist between even the most troubled or taciturn individuals and the animal they take to heart. Now he was hearing of the genuine love and heartbreak - undiminished over more than half a century - that still attached to those unwitting recruits, the cavalry steeds of 1914-18.

"I went off and did some digging in the records," he says. "A million horses were shipped over to France from Britain - only 62,000 came back. And they tended to be the officer class mounts. The remainder - including animals who had been the backbone of many rural communities before the war - were sold ... to French butchers for meat. When I think of the recent outcry about finding horse-meat in our frozen lasagnes ..."

His chuckle is distinctly mischievous, yet rueful. At 70, Morpurgo is still in full possession of an astute sense of humour, as well as a lifelong commitment to the cause of peace. The emotions that surfaced in response to the recent hugely successful staging of War Horse in Berlin are palpable in his voice when we talk.

"There was real relief, yes," he admits, "that people understood that War Horse is not about taking sides or apportioning blame. Joey, the horse at the heart of the story, isn't a political animal. He does what is demanded of him by either side - whether that is charging a line of enemy fire or pulling a field ambulance. It's what we do to the animals - to the people - who trust us, that is the problem. That is where the suffering, the horror, the grief and waste of war is rooted. And that is what I hope War Horse says to its audiences worldwide."

In fact, over four million people all across the globe - and a long list of prestigious awards - have already responded, with unstinting accolades, to a stage production which will arrive at Edinburgh's Festival Theatre on Wednesday for a short season. Chances are Morpurgo himself will drop by - as some of the cast tell me, when we meet backstage at the Lowry in Salford, he not only spends time chatting with them, he's been known to fetch up on-stage as part of the ensemble. Being Joey, however, is a matter for one of the three teams who have trained specifically to animate the huge, visually-striking sculpture-cum-puppet that was created for the production by the Handspring Puppet Company from South Africa.

Joey Head (Thomas Gilbey), Joey Heart (Michael Humphreys) and Joey Hind (Andrew Keay) had never met before they auditioned for War Horse, and were then brought together as one team for an eight-week training and rehearsal period. All three agree that, whatever else is involved in bringing Joey to life - and there are all kinds of mechanisms that control ear-waggle or tail-flick, for instance - the most important factor is his personality.

Humphreys explains that one of the first things they had to do together was "establish this team rhythm as Joey. If something happens on-stage - and with people milling about in the war scenes, especially, there's always a risk of someone getting in the way, or not being where you expected - you immediately have to tap into that team rhythm. You can never go off on an individual tangent because Joey, as an entity, is all three of us."

Keay - who trained at the Royal Conservatoire of Scotland - chips in, adding: "I don't think any of us think of as Joey as a puppet. We've all trained as actors, not puppeteers, and for us Joey is a role. He's a character, with three actors playing him all at the same time. He's a composite, really, of what we think his character is - and we still talk about that a lot. Usually, it's just you and a director trying to develop the character in a role. Here, there are three different points of input, and it's been fascinating working out how to express Joey's moods, his reactions, in ways that we all agree on and feel are right."

Gilbey, meanwhile, has been musing on what it's like "working with, or rather as, something that isn't really you. You have to employ everything you've got as an actor, relay that in performance - but get very little back, in a way, because the audience isn't looking at you. All their focus is on the puppet. When we do the final bows, they do clap for us along with the rest of the ensemble - but when Joey comes back on, with us as him, there's always a massive cheer. That's when - and how - you know you've done it right."

Listening to this is Lee Armstrong, who plays Albert, the young lad who follows his beloved Joey to the front and finally brings him home again. Armstrong reckons he can tell which of the three Joey teams is on-stage. "I've named them after Hogwarts houses," he says, grinning. "Gryffindor is stupid and brave, Slytherin is cheeky and naughty, and Ravenclaw is intelligent and right down the line. Which one are they?" He nods towards Team Joey across the table. "I couldn't possibly say!"

What he - and the others - will say is how absorbed they have all become in the history of the period. "It goes beyond the campaign dates," says Armstrong. "There were young men all across rural communities who were needed on the land, and who probably had no real connection to the idea of "for king and country" - and no wish to fight a war, let alone kill anyone. But the people in power, up in London, had their own agenda. And they were able to send lads like Albert and horses like Joey off to die for reasons that were all to do with economic gains and political score-settling. And when you start exploring that history, you understand why War Horse has such relevance and importance today."

Tickets for War Horse at the Festival Theatre, Edinburgh are now sold out. Please check the website www.edtheatres.com for updates on returns.