A policy which allows British security service agents to commit serious criminal activities including violence is lawful, a tribunal ruled by a slim majority on Friday.

Four human rights groups had argued that it was against British law and the European Convention on Human Rights for the MI5 domestic spy agency to permit agents, those who are informants or provide intelligence but do not work directly for the government, to commit crimes, including murder and torture.

In its submissions, the government said it would be impossible for MI5 to operate, gather intelligence and prevent “terrorist” attacks without using agents and it was necessary for agents to be allowed to be involved in criminality.

However, it said that it did not give them immunity from prosecution.

The Investigatory Powers Tribunal (IPT), which deals with complaints about the intelligence services, backed that view, making reference to recent deadly attacks. However, two of its five members disagreed with the decision.

“This case raises one of the most profound issues which can face a democratic society governed by the rule of law,” the IPT said in its ruling.

“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.”

Privacy International, Reprieve, the Committee on the Administration of Justice and the Pat Finucane Centre said the once-secret MI5 policy had been in operation at least since the early 1990s and had only come to light when former Prime Minister Theresa May acknowledged its existence in 2018.