SUMMER, 2014. Writer Karen Campbell and her husband Dougie are walking the four miles from the Tuscan hill town of Barga up to the village of Sommacolonia. Slowly, they make their way through chestnut trees, noting every rise and dip, every hair-pin bend, every over-hang of rock. The sun is shining on the Serchio Valley and the scent of wild thyme hangs in the air. But Campbell and Dougie are retracing the journey taken by “buffalo” soldiers from the 92nd Infantry of the US army – a segregated black division – on Christmas Day, 1944; so they are pretending it is winter.

"I kept imagining how much harder it would be if the path was icy, and if you had a pack on your back, how that would push you forwards," Campbell tells me over lunch at her Galloway home. "There might well have been Nazis shooting from above and they would have walked through the Corsonna [River] so they would have been soaking wet."

The ensuing battle is the centre point of Campbell's latest novel, The Sound of the Hours, a sprawling wartime romance between local girl Vita Guidi and buffalo soldier Frank Chapel, who find themselves on the front between the Allies (supported by Italian partisans) and the Germans (supported by Italians forces still loyal to Mussolini).

This part of Tuscany straddled the Gothic Line, a German defensive corridor of concrete bunkers, anti-tank ditches and machine gun nests that ran from north of Viareggio on the Ligurian Sea, to Pesaro on the Adriatic.

A fascist stronghold, the region also had strong links with the west coast of Scotland, with its enduring history of socialism. In Barga the ties are so intertwined, with families moving back and forth, it is impossible to tell where one culture begins and the other ends. A red telephone box, turned into an ad hoc library, is as likely to contain Ian Rankin's crime novels as Carlo Lucarelli's, while unwitting tourists are startled to hear Glasgwegian accents come out of the mouths of Italian natives.

Campbell was intrigued by this clash of identities. "In 1943, when the King of Italy decided to to switch over to the Allied side, everyone thought: 'that's the war over'," she says.

"Mussolini was arrested, but he was sprung out of jail by the Nazis and reinstated in the north. So, then you had Italy at war with itself. You could have two brothers fighting on different sides. Some of the Carabinieri [local police] became partisans while others joined the Ovra [the secret police].

"On top of that there was the fact that Barga is so Scottish. You go into an ice cream shop and say: 'Un gelato, per favore' and the woman who has been speaking in Italian will reply: 'Do you want a cup or a cone, hen?'

"All this got me thinking. The people in this part of Italy are being bombarded on both sides. Fascism is crumbling and, potentially, their family in Scotland are being interned. Where do their loyalties lie?"

Vita's mother is a Mussolini devotee; her father, who was born in Scotland, is not; he is taken away in the rastrellamento (a rounding up of men to provide slave labour).

"I suppose you see it now in Brexit Britain," Campbell says. "Vita's dad is a socialist who has always muttered under his breath about the fascists, but, all of a sudden, these are the people who are going to take you away. When it's a matter of life and death the cracks become massive fissures. How do you repair that afterwards?"

The initial spark of inspiration for The Sound of the Hours was not tensions in the Italo-Scots community, but the buffalo soldiers who liberated much of Tuscany. "In 2012, we were on holiday with [Glaswegian writer and broadcaster] Sergio Casci, and one afternoon we went for lunch in Sommocolonia.

"I spotted this plaque to John Fox [a buffalo soldier who sacrificed himself for the sake of his fellow men] and wondered what he was doing there. I started to learn about the discrimination they suffered at home and how they were sent abroad to die. There was such a melting pot of identities to explore."

Sitting in her kitchen, an evocative painting of a Tuscan house on the wall in front of her, Campbell, who has shoulder-length dark hair, could easily pass as an Italo-Scot. But she has no genetic link and, prior to that holiday, no emotional link with Italy. Wasn't it audacious to embark on a story about a complicated conflict in a place she had rarely visited , especially when much of the source material was in a language she didn't speak?

"It is the hardest thing I have ever done," she admits. "No wonder it took me four years."

Campbell, a former police officer, was also hampered by Italy's failure to properly memorialise its war years and by the desire to make sure Frank's journey through the country was accurate and his meeting with Vita logistically possible. At one point, she found herself plotting points on a wall map, like a TV detective pursuing a serial killer .

To understand the life of a buffalo soldier, she read several autobiographies which gave her an insight into the racism they encountered. After joining up, Frank is forced to sit behind a curtain in the dining car of a train so as not to offend white passengers.

Campbell was blessed with several lucky breaks. In Borgo a Mozzano she found a local historian willing to show her the remains of the Gothic Line; it is still possible to see the gun holes through the foliage.

Her most significant find was the diary kept by the Monsignor of Barga's Duomo (cathedral), which she read with the help of Google Translate. "I have no idea what the Monsignor was like as a person," she says, "but his diary contains the dates the bombs fell and wee details like how they kept the rabbits in the basement for food."

For someone like me, who visits Tuscany regularly, but knows little about its history, The Sound of the Hours is a revelation. My family is from Lucca, and I have spent many hours on its walls, but had no idea the city was liberated by Buffalo soldiers, nor that that the partisans were responsible for opening the gates.

Campbell says the hardest part about writing the book was deciding which incidents to include and which to leave out. "I had to constantly rein myself in," she says. "One tragedy that made it in is the massacre at Sant'Anna where Italian refugees were sheltering. During an operation against the partisans, the Waffen-SS and the Brigate Nere [fascist Black Brigade] executed 560 people, including 100 children, then burned their bodies."

"Sant'Anna has an air of sorrow about it, like Glencoe," Campbell says.

Given The Sound of the Hours was so demanding, I had expected to find Campbell in a literary slump. Instead, since finishing her Italian epic, she has written a short book about a homeless woman who returns to Galloway. "I wrote it in three months," she says. "It was like eating a sorbet after a banquet."

This book gave her an excuse to explore the environs of her own home. In September, though, she is travelling back to Barga to take part in the town's annual Scottish week. Her Italian is still limited, but she feels a bond with the place – a bond that has been strengthened by a serendipitous discovery about the picture on her wall.

Campbell had spotted the painting in the villa she and Dougie rented the first time she travelled to Italy to research the book. Unbeknownst to her, Dougie arranged to have it brought to Scotland for her 50th birthday. It was only later she realised the house it features is the home of Giovanni Pascoli, the poet who wrote the lines from which the title of her book is taken.

Another Tuscan totem is a sprig of thyme she picked on the road from Barga to Sommacolonia. Roman soldiers used to pass the herb to one another as a symbol of courage. The Greeks placed it on coffins. Campbell had her sprig pressed and framed and mounted above her desk: a daily reminder of war and love and loss.

The Sound of the Hours, by Karen Campbell, is out on Bloomsbury, priced £13.49.