The court was furnished in blond wood. There were no wigs and the accused man wore a jersey. But the informality was in contrast to the gravity of the charges. An army officer was on trial for a war crime: the killing of 11 innocent women and children in Afghanistan.

I found myself willing a witness to lie on his behalf. I wanted his colleague to commit perjury so that the officer would be acquitted. I wanted the articulate prosecutor to shut up. I wanted the accused man cleared and to hell with the technical truth.

And no one was more surprised by that than me. Fortunately the court case was in the new acclaimed Danish film, A War. I won’t tell you the outcome for fear of spoiling the plot. I will just say that, having walked on patrol in Helmand province with this army officer, having seen him interact with his men and shared in his phone calls home to his wife and children, it was my opinion that, in that court room, justice and truth were on opposite sides.

I’d seen a decent man, in the thick of battle, make a bad judgment call. I had not seen criminality. That’s the thing about war. Most of us can have no idea, no understanding of what it entails. We bring the law to bear upon those who fight foreign battles in our name. We hold them to a set of legal standards that are reasonable, civilised and easily upheld in peace: standards than can be fragmented when soldiers fear for their lives and for their comrades.

And yet we can’t offer them carte blanche. So how is justice best served?

The question is pertinent as prosecutors are examining dozens of cases in which British soldiers are accused of unlawfully killing Iraqi civilians. The director of the Service Prosecuting Authority (SPA) – the military equivalent of the Crown Prosecution Service in England – has said it "will not flinch" from acting against British soldiers who are found guilty.

It’s not that I want a whitewash. I come from Northern Ireland and I lived through part of The Troubles. There, too, soldiers were accused of unlawful shootings. At the time I decried knee-jerk denials from elements of the British press that equated the words soldier and hero. I observed the damage caused by prejudiced responses.

Up close and on the receiving end of their authority, British soldiers looked to me very much like any other group of men. Some were admirable, most were ordinary and a few were a bad lot.

They were doing an almost impossible job under difficult and uncomfortable circumstances. That didn’t – and shouldn’t – have offered them immunity when they shot innocent people.

In each case the circumstances needed to be examined promptly and fairly. It was the only way to retain trust. I can say that in the same breath as wanting to defend the fictional soldier in Afghanistan. I feel no contradiction because fairness and justice are at the heart of both.

To me, what matters when a bomb is detonated or a trigger is pulled is intention. If a soldier shoots in cold blood or orders an attack to kill or main civilians, there is a case to answer. If the damage to civilian life is unintentional, he should be exonerated.

What we seem to disregard – in my opinion wrongly – is the part played by panic, ignorance, partial knowledge and, importantly, cock-up.

Fighting men are shot by their own side; hospitals are shelled in error. Theatres of war are untidy and fearful places. Nerves are frayed; judgment is often skewed. When errors occur the desperate loyalty of fellow fighters – often supported by establishment cover up – further muddies the water.

We can expect more of this in the future. Soldiers who fought in Iraq are also to be pursued for financial compensation by Iraqi civilians. The law firms representing the claimants have already been dubbed "ambulance chasers" by Defence Secretary Michael Fallon.

Similarly in Northern Ireland, there are large claims relating to that even more historic event, Bloody Sunday. But should these be put on the shoulders of the individual men caught up in the frenzy of that day? Or should the Ministry of Defence take on that onerous burden? How fair is it to pile years of strain and distress on the lives of former service personnel when, in most cases, war itself is to blame?

Look at the situation of the airmen flying sorties over Iraq and Syria. These are, according to David Cameron, embarking on legal missions of war. He assures the British public that everything possible will be done to avoid civilian casualties. That’s a tacit admission that some innocent people will die.

So who should answer for their deaths? The pilots who launch their missiles and drop their bombs? The politicians and generals who send them into battle? No one at all?

Should we reserve criminal charges and compensation claims for deliberate, cold-blooded and illegal acts against individuals?

The case against Royal Marine Sergeant Alexander Blackman seemed clear when we heard recordings of him shooting an injured Afghan insurgent saying: "There, shuffle off this mortal coil. It’s nothing you wouldn’t do to us."

Blackman is serving a life sentence for murder. His minimum term of 10 years was commuted to eight. The prosecution pointed out that this was "not a killing in the heat and exercise of any armed conflict ... it amounted to an execution.’

Even so, there are difficult questions to answer. Blackman was suffering from combat stress disorder. He was a soldier of 15 years standing who claims he made a "split-second mistake".

How much killing had he seen? What was the psychological impact? If he didn’t view Afghan insurgents as legitimate targets, could he have done the job we sent him to do? If the helicopter had killed the man instead of injuring him, would that too have been murder?

The 100,000 signature petition to quash Blackman’s conviction is evidence of the discomfort people feel when serving soldiers are convicted of murder.

I’m not suggesting we train men and women to kill and then let them loose with no legal constraint. But we need to acknowledge the murk in their circumstances. Should the context of bloody conflict make a legal difference?

In the BBC dramatization of War and Peace and you will see a clearly defined battlefield in which there is carnage. But we no longer have delineated battle fields. We often no longer have a front line.

Wars are fought in domestic settings with non-uniformed combatants. Serving soldiers need hair-trigger responses if they are to survive. They need strong moral codes and great wisdom to ensure they make the right call every time. Sometimes they fail. They let themselves down. They kill innocent people.

They must live with the ghosts of the lives they have taken on their conscience.

For the few who are bad men, who kill in cold blood, let them be prosecuted.

For the vast majority lifelong guilt is punishment enough. If they are to be tried and found guilty so too should their political masters who, in the case of Iraq, sent them into battle with little regard for legality.