I was signing books at the Wigtown Book Festival when a distant relative appeared from nowhere and handed me an old black and white picture of my father and mother's wedding day that I'd never seen before.

Unfortunately, they left before I could thank them properly.

Or speak to them, because I really wanted to ask about my father's father Robert Macwhirter and his attitude to the First World War. Both my late father and his father were conscientious objectors in the Second World War and the Great War respectively. They paid a price for their pacifism.

My dad had his promotion in the civil service blocked for 14 years, even though he would never have been called up because of his age and status. My grandfather, according to family legend, was sacked as an elder of the Kirk for opposing the call up in 1914. Imagine being thrown out of today's Church of Scotland for being anti-war.

I am from a generation of my family which has never had to face the moral dilemma of whether or not to fight for my country. And now that the 100th anniversary of the Great War upon us, I've been anxious to learn anything I can about my grandfather's act of principle. It can't have been easy to be a pacifist in Scotland in 1914

More Scots volunteered for service in the First World War than any other region of the UK, and many more died. Around 550,000 Scots answered the call and 26% of them were killed, against an average of only 12% mortality in the rest if the British army. It is part of nationalist folklore that Scots were used by English generals as cannon fodder, but the truth is rather more complex.

In fact, the Scots were only too willing to go over the top, and a lot of generals from Haig down were Scottish. The Jocks were aggressive soldiers who tended to place themselves in the front line of any battle. And, remember, they had been fighting Britain's wars for most of the previous 200 years.

Indeed, Scots had been fighting other peoples' wars since the Middle Ages and days of the fearsome Gallowglass mercenaries. In the Scottish wars of independence in the 13th Century, this tiny impoverished country, with only a handful of knights, took on a medieval military superpower: England. And won, sort of. Though the fighting didn't stop.

But come the 15th Century, more Scots were fighting against the English as mercenaries in France than in Scotland. By the time of the Thirty Years War in the 1600s, up to a fifth of Scottish men were fighting abroad, in Sweden, Holland, France, Russia, Poland. Fighting for money was better than trying to scratch a living out of Scotland's poor soil. And the Scots were good at fighting - very good. One reason why the Covenanters of the early 17th Century were such an effective a fighting force was because Alexander Leslie was able to draw on 50,000 battle-hardened Scottish mercenaries from European wars.

After the 1745 Rebellion, large numbers of Highland Scots swapped their tartan for a red coat and fought for the British army. "They are hardy, intrepid and there is no mischief if they fall", said the British General Wolfe, before he led the Highlanders to victory at the siege of Quebec in 1759. From the Napoleonic Wars to the First and even the Second World War, the Scottish regiments were always in the thick of the action. The Scots Greys crying "Scotland Forever" at Waterloo; The Thin Red Line in Crimea; the bagpipes at Arnhem.

Scottish men were immensely proud of their warlike reputation. Scots in the 19th Century were smaller than English recruits because of their poor nutrition, but they made up for their lack of stature with their valour in battle. The Wee Hard Man was born fighting for the British Empire. Mind you, Scottish women may have had a different view. They had to try to keep the family together when the man of the house was "awa for a sodjer".

Half of those who went off to fight in foreign wars in the 19th Century didn't come back, and those who did often had horrific injuries. It was a miserable price to pay for a few regimental battle honours. But the ties that bound Scottish working class men to the regimental traditions of the British state proved stronger than ties of nation or class.

James Keir Hardie was appalled in 1914 when so many of his countrymen set aside working class internationalism to fight an imperialist war. On one day in Glasgow alone 35,000 men signed up. What did they get out of Empire? A tubercular Glasgow tenement, crammed 12 to a room, where child mortality was 20%? But perhaps the Labour Party founder missed the point: one reason for the epidemic of patriotism in 1914 was the opportunity to escape the grind of urban poverty.

Moreover, this martial spirit was, and remains, a very important aspect of Scottish male identity. My father and his father were extremely unusual in standing apart from this culture, and I've often wondered what personal conflicts they suffered as a result. In many ways, being a pacifist in 1914 required more moral courage than signing up with the intoxicated masses.

What relevance has this violent heritage today in referendum year? Well, one important reason why many Scots today are still emotionally wedded to the United Kingdom is because of the blood they shed for it. Scots never felt they were a colony of England and have never been in need of liberation. When Scotland lost its parliament in 1707, Scots were able to claim that they had never been defeated by England but had entered into a kind of perpetual military alliance after the Treaty of Union.

Again, this may have been a self-delusion, but it was an important one politically. And of course many middle class Scots did well out of the Empire.

They not only fought Britain's wars, they ran the colonial administrations, managed the great British trading monopolies, evangelised the heathen.

It seemed a reasonable deal, even if Scots were very much junior partners in the imperial enterprise.

And this is one reason why the concept of independence is a difficult one for many Scots to grasp today. Independence from what? From a United Kingdom that Scots helped create? Hardly. To be liberated from a Great Britain that their forefathers fought and died for?

Alex Salmond understands this well, of course, which is why he's tried to refashion nationalism to accommodate elements of imperial British identity: the pound, the Queen, Scottish regiments, military co-operation in Nato.

The British Empire is no more. Now that the Scots are no longer needed to fight other peoples' wars, the SNP leader hopes they will start fighting their own economic war back home, creating the businesses and institutions of a modern state.

Maybe. But the anachronistic echoes of the Scottish martial tradition remain, as does that lingering attachment to a United Kingdom that died in the trenches. (And my interest in my grandfather and WW1. I would be most grateful for any information about him at: iainmacwhirter@mac.com)