Martin McGuinness always insisted he had “no role whatsoever” in the IRA’s “execution” of British army agent Frank Hegarty from Derry in May 1986. British intelligence sources always insisted otherwise. And they “knew”, it has now emerged, because they were listening in to calls from the Hegarty family in Derry to Hegarty’s safe-house in Sittingbourne, Kent.

The calls came almost every night. In some, Hegarty’s elderly mother Rose was heard telling her son that McGuinness was with her and that McGuinness had assured her he would be safe if he came home.

This account given to me independently during the preparation of the BBC Panorama programme The Spy in the IRA corroborates the account given for years by the Hegarty family of McGuinness’s role.

McGuinness won their trust, they say, by inveigling his way into their home with cosy chats “practically every other day” over 13 weeks, going down on his knees to hold Rose Hegarty’s hands.

Freddie Scappaticci: The British army said Stakeknife’s intelligence could be credited with saving some 180 lives. Photograph: PA

There, he solemnly swore that all her son had to do was “talk with some men” across the Donegal border. Three days later, Hegarty was found with four bullets in his head.

McGuinness countered by affecting a noble silence. “I’m not going to add to their grief and their pain”, declining to explain what he said was the true “role I played at that time”.

He was acutely sensitive to the charge that he had manipulated Hegarty’s vulnerable family, an episode that tainted his redemptive image change from IRA commander to straight-talking, peace-seeking politician.

While McGuinness may have lured Hegarty back, the intelligence services stand accused of knowingly abandoning him, even though he had risked his life by disclosing the location of a major Libyan-supplied arms dump.

Hegarty was run by a branch of military intelligence called the Force Research Unit (FRU). Former FRU operatives have maintained that if ever they were in a position to save an agent, they always would.

However, this sits oddly with the intelligence available to them from inside the IRA unit responsible for interrogating and executing fellow British agents such as Hegarty, the so-called Nutting Squad.

One of its members – and from the late 1980s its head – was Freddie Scappaticci. In reality, he was also Agent 6126 – codenamed Stakeknife – who had worked as an agent for the FRU since 1979.

Better than anyone, Scappaticci knew the fate facing Frank Hegarty. Yet there was no attempt to warn him during the 3½ weeks he was in Derry after his return from England.

A tip-off raised serious problems, certainly. It could have compromised Stakeknife’s cover and lost intelligence from a spy whose unique access to the IRA had the potential to save many others.

“It really is a moral maze and a moral conundrum” as to how this kind of dilemma “was actually balanced out”, says Ray White, former head of the police Special Branch in Belfast.

“In the one or two circumstances that I do have a recollection of, we did our utmost.” He said he had the “greatest admiration” for those who became agents. “If medals were handed out, they’d be in the front of the line,” White says.

Thirty people were killed during Scappaticci’s time as IRA interrogator. Not all were registered agents such as Hegarty, but the majority provided information to the security forces.

Yet they were not saved from interrogation and death, sometimes even after being tortured. In defence, the British army said Stakeknife’s intelligence could be credited with saving some 180 other lives.

Main players

Freddie Scappaticci (bottom left hand corner of picture) pictured at the 1987 funeral of IRA man Larry Marley near Martin McGuinness. Photograph: Pacemaker

However, this figure is not the number of lives saved as a direct consequence of the British acting on Stakeknife’s intelligence, with a murder prevented or a bombing foiled. Instead, the 180 figure is partly the army’s “guesstimate” of lives that would have been lost had Stakeknife’s intelligence not led them to recover weapons from various dumps.

In addition, Scappaticci contributed significantly to “building a picture” of the IRA. “He knew all of the main players and picked up a tremendous amount of peripheral information,” says one FRU veteran. “As the [IRA] campaign changed and the political side became more important, again he was highly placed to comment on that”. Maybe so, but building pictures is an impossible way to quantify actual lives saved.

By contrast, a classified Northern Ireland Police Ombudsman report links Scappaticci “to some extent or another” to 18 of the 30 killings carried out by the Nutting Squad during the height of the Troubles

History suggests that no state can fight terrorism successfully without some compromises of the legal and moral standards appropriate in peacetime. The question raised by Stakeknife is: did the British state go too far?

Judged by the strict letter of the law, the answer must be yes. British ministers from every prime minister down always emphasised that the Northern Irish conflict was not a war and that the state maintained the rule of law.

If, says human rights lawyer Sir Desmond de Silva, this is to mean “more than a rhetorical flourish, it must be seen to manifest itself wherever wrongdoing by state officials is suspected or exposed”.

Having received the ombudsman’s report, the North’s Director of Public Prosecutions Barra McGrory presumably felt he had no choice but to order a criminal inquiry into the agent and the way he was run by the intelligence services.

The result is Operation Kenova, which has a 50-strong team of hand-picked detectives with a £35 million (€41 million) budget who are trying to establish if lives were sacrificed to keep Stakeknife – the British army’s “golden egg”, as one general described him – in place.

The evidence suggests there were times when the intelligence services “played God” by deciding which agent lived and which agent died. The case of Joe Fenton is an example. He was an RUC Special Branch agent who ran an estate agency on the Falls Road. The RUC helped him establish his business. In turn, he provided the IRA with “safe houses” that were, in fact, bugged by MI5.

Inevitably, the weapons’ finds and arrests that flowed attracted the IRA’s suspicion. In June 1988, Fenton was interrogated by Stakeknife. He was released.

A few months later, a mortar-bomb factory was raided. Stakeknife told his FRU handlers he would have to interrogate Fenton again and warned them that he would not survive this time.

On Saturday, February 25th, 1989 Fenton was bustled through the front door of a house in Lenadoon in Belfast and into an upstairs bedroom. There to greet him was Scappaticci. After a violent struggle, Fenton confessed.

At nightfall the next day, Fenton was marched out of the door. One hundred yards on, he made a desperate run for his life. His executioner shot him in the back, held him down and put three bullets in his face and one in his head.

Different priorities

Operation Kenova will investigate why Fenton was not warned that he was about to be interrogated again and why the British army and the RUC never arrived when he was.

The fact that Fenton was run by RUC Special Branch and Scappaticci by the army’s FRU may offer a clue: they were two different intelligence-gathering agencies with different priorities.

When Special Branch received Stakeknife’s intelligence, the FRU usually added a major caveat: “No action to be taken without direct reference . . . to FRU.”

So, although the police had primacy, in practice the FRU sought to restrict their freedom to act on Stakeknife’s intelligence because the FRU prioritised maintaining the cover of their most prized agent.

What is clear is that there was no agreed legal framework by which state agents were managed during the conflict. Instead, they were run according to non-statutory guidance.

Turning a blind eye to state agents getting blood on their hands was manifestly illegal. Equally, without such agents the supply of actionable intelligence would have dried up.

Declassified 1986 documents show that senior British figures, including the director general of the MI5, asked politicians, including the then prime minister Margaret Thatcher, to lay down a legal framework.

Yet they were, in effect, seeking to make lawful active participation in serious terrorist criminality. Small wonder, after five years of internal debate, the issue was kicked into the long grass.

In 1992, the British solicitor general said: “The thrust appears to be, ‘Don’t get caught!’ This is unpromising territory for ministerial approval.” Perhaps Kenova needs to knock on doors in Whitehall as well as Belfast.

The officer leading Operation Kenova is an experienced counter-terrorism detective, Jon Boutcher, now Bedfordshire’s chief constable. One senior colleague familiar with Belfast told him he was “bonkers” to have accepted the job.

Another senior ex-operative says dryly that “all Kenova will show is that an anti-terrorist war is a particularly dirty war, and it’s dirty for everyone involved on both sides”.

Criminal charges

An equally sceptical Ray White says: “I see Boutcher having an evidential mountain to climb having to unravel all that intelligence alleged to be associated with Stakeknife.”

Kenova is tasked with establishing which lives Stakeknife’s spymasters genuinely had no prospect of saving and which lives they could have saved but chose not to because they wanted to protect Stakeknife’s cover.

But within those two poles lies a swathe of elusive evidential “mush” from which hard facts will need to be teased out if Kenova is to bring criminal charges beyond Stakeknife himself to the spymasters responsible for him.

How might Operation Kenova do this? They will need more than the partial intelligence records that have survived and the distant recollections of intelligence personnel, many of whom may be reluctant to talk anyway.

And what about IRA members executed as informers by the IRA? Michael Kearney in 1979 and Anthony Braniff in 1981, for example, who have since been exonerated by former comrades?

There is compelling evidence to suggest that Stakeknife played a key role in their deaths. But are we really to expect charges against the intelligence services for not stopping their killings?

In law, we are now told, the intelligence services had a duty of care even to loyal IRA combatants mistakenly shot as spies, provided Stakeknife gave his handlers advance warning of their impending deaths.

However, the military mind sees anything that disrupts the enemy as fair game. “Personally, I didn’t give a rat’s arse if the IRA were going to shoot one of their own,” as one intelligence source puts it pithily.

Yet article 2 of the European Convention on Human Rights requires states to take all reasonable steps to protect a person’s right to life irrespective of whether that person is a civilian, soldier or the enemy.

During two decades covering Northern Ireland, I never once heard mention of article 2. Only since the Human Rights Act of 1998, after the Belfast Agreement, has it been incorporated into UK domestic law.

Some in the intelligence services fear Operation Kenova will apply “hindsight bias”, where yesterday’s actions are judged by today’s standards. “Hindsight shines an awful bright light,” says White wryly. “It puts into dimness and darkness all the uncertainties and ambiguities that were there at the time.”

He has a point. But only up to a point – and here’s the rub. A myth about agent-running is that handlers are in control. They are not. In Stakeknife’s case, there were times when he did not inform his handlers before he was about to interrogate a suspected informer.

Boutcher has made it clear that he understands that the difficult operating environment may well have impaired the ability of the intelligence services to have prevented some killings. Sometimes.

All of the 30, except Kearney, were shot during the 1980s. There surely has to have come a point at some stage during that decade when it dawned on Stakeknife’s handlers that they were acquiescing in, tolerating, colluding – call it what you like – his involvement in preparing fellow agents/informers for death as the price of keeping him in place.

It is also surely just as inconceivable that the defenders of the British realm, MI5, did not go along with this. Indeed, one former FRU commanding officer has emphasised to the police that MI5 was a key recipient of Stakeknife’s intelligence product. How did MI5 think Stakeknife was getting his intelligence?

And this is where the threat from Kenova to the reputation of the intelligence services lies. As Desmond de Silva has said, there was and is no legal basis for prioritising the right to life of an agent over an individual under threat, even if protecting that agent’s cover might save more lives later on.

Boutcher is an unshowy detective and plays his cards close to his chest. He’s also politically savvy and knows that English policemen bearing promises of turning over every stone do not have much currency in Belfast.

Vested interests

In Belfast, it has all been seen before: Stalker, Sampson and Stevens. None of them netted the so-called securocrats, even though Stevens, especially, dug out a huge amount of material that would never have seen the light of day.

And yet Boutcher seems confident that he will be able to tease out those cases where there was no credible excuse for the agencies allowing people to die, be they agents/informers or those who were neither.

He has a pedigree. Following 9/11 he secured a 30-year sentence for British al-Qaeda operative Dhiren Barot and seven British-born accomplices of Pakistani heritage.

Ignoring prosecution counsel’s insistence that he would never get the evidence required to lock them up, Boutcher flew off to Pakistan and did exactly that. Operation Kenova, however, may prove a different kind of challenge.

Of all the previous inquiries into Northern Ireland’s undercover war that have taken place over years, none has the potential to threaten as many vested interests as Kenova.

It goes beyond Stakeknife, military intelligence, RUC Special Branch and MI5. And even the Public Prosecution Service.

Meanwhile, Kenova’s sights are also targeted on members of the IRA’s provisional army council who sanctioned the murder of agent/informer suspects as required by the IRA’s rule book.

If any of these IRA grandees are lifted, it will do nothing to restore devolved government to Northern Ireland as it regresses into a period of direct rule overshadowed by Brexit.

Operation Kenova is one investigation into the past in which some British ex-spymasters and their IRA adversaries today have a mutual interest in seeing it not succeed.

Former Metropolitan Police commissioner Lord Stevens was the only senior colleague to urge Boutcher to accept the challenge. “Kenova is the ultimate test of detective work,” says Stevens.

John Ware presents The Spy in the IRA, a BBC Panorama special broadcast on Tuesday, April 11th at 10.45pm on BBC One and at 11.10pm on BBC One in Northern Ireland