MI5’s partially secret policy allowing agents and informants to participate in serious crimes is lawful, judges have ruled by a three-to-two majority.

In a 56-page judgment, the investigatory powers tribunal (IPT), which hears legal complaints about the intelligence agencies, declared that the guidelines do not breach human rights or grant absolute immunity to those who commit offences such as murder or torture.

It is the first time the IPT has published dissenting judgments, both of which in this case are highly critical of the statutory framework surrounding the handling of agents. Many of the key arguments turned on the exploitation of informants within the IRA and loyalist paramilitaries during Northern Ireland’s Troubles.

The coalition of civil liberty groups that brought the challenge – Reprieve, the Pat Finucane Centre, Privacy International and the Committee for the Administration of Justice – announced immediately they would appeal.

Opening the majority judgment, Lord Justice Singh, Lord Boyd and Sir Richard McLaughlin acknowledged: “This case raises one of the most profound issues which can face a democratic society governed by the rule of law.”

Lawyers for the civil liberty organisations argued that what is known as the “third direction” – guidelines permitting agents to become involved in criminal conduct, which were revealed in March 2018 – were illegal.

Crucial details of the guidelines specifying whether there are limits on such criminal activity remain secret. Part of the IPT hearing was held behind closed doors with the media and lawyers for the claimants excluded. The tribunal has also published a secret or “closed” version of its final judgment.

Explaining that the third direction guidelines are still not published in full, the majority judgment states: “For the reasons which are set out in our closed judgment, there is no more of the text of the guidelines which can properly be put into the public domain.”

Maya Foa, Reprieve’s director, said: “The IPT’s knife-edge judgment, with unprecedented published dissenting opinions, shows just how dubious the government’s secret policy is. Our security services play a vital role in keeping this country safe, but history has shown us time and again the need for proper oversight and common sense limits on what agents can do in the public’s name.”

Dr Ilia Siatitsa, a legal officer at Privacy International, said: “Today the investigatory powers tribunal decided that MI5 can secretly give informants permission to commit grave crimes in the UK, including violence. But two of its five members produced powerful dissenting opinions, seeking to uphold basic rule of law standards.

“We think the bare majority of the IPT got it seriously wrong. We will seek permission to appeal to protect the public from this abusive secretive power.”

The majority decision said: “[European] convention [of human] rights issues do not arise as a matter of substance in this challenge to the policy of the security service .… The events of recent years, for example in Manchester and London in 2017, serve vividly to underline the need for such intelligence-gathering and other activities in order to protect the public from serious terrorist threats.

“It is not the effect of either [MI5’s] submissions or the judgment of the majority in this tribunal that the security service has the power to confer any immunity from the ordinary criminal law of this country or the civil law.”

The security service, known as MI5, has issued guidelines on the use of agents who participate in criminality, the judgment points out, which say that representations are made to the police and the Crown Prosecution Service about whether criminal charges would be in the public interest.

The guidelines state that official authorisation does not confer immunity but instead act as “the service’s explanation and justification of its decision should the criminal activity of the agent come under scrutiny by an external body, eg the police or prosecuting authorities”.

“In particular, the authorisation process and associated records may form the basis of representations by the service to the prosecuting authorities that prosecution is not in the public interest.”

In the first dissenting decision, Charles Flint QC said: “I entirely accept the operational necessity for the service to run agents who may need to participate in serious criminal activity.”

However, he added, the policy under challenge “has been exercised with scrupulous care by the security service so as to discharge its essential functions in protecting national security, whilst giving proper regard to the human rights of persons who may be affected by the activities of agents”.

But, he concluded he was “unable to find that the 1989 [Security Service] Act provides any legal basis for the policy under challenge”. Flint said the existing law left agents and handlers “unduly exposed” and “cannot be regarded as being in accordance with the law under the European convention on human rights”.

In the second dissenting judgment, Prof Graham Zellick QC, was more critical, arguing that parliament had never authorised such a policy. And he added: “To accede to [MI5’s] argument would open the door to the lawful exercise of other powers of which we have no notice or notion, creating uncertainty and a potential for abuse.”

During the hearing, Ben Jaffey QC, representing the coalition of civil liberty groups, said the policy in effect meant that MI5 was granting immunity to its agents. He pointed out that police have recently recommended that more than 20 people, including senior officials, should be prosecuted for murder, kidnap, torture and perverting the course of justice following an investigation by Operation Kenova into the handling of agents inside the IRA during Northern Ireland’s Troubles.