Two Northern Ireland rights groups have lost a case in which judges found it lawful for MI5 to authorise agents to commit crimes like murder.
The Committee on the Administration of Justice and Pat Finucane Centre will appeal.
They were among four organisations who challenged a government policy they claimed "purports to permit (MI5) agents to participate in crime".
Judges ruled by a three-to-two margin in favour of MI5.
It means they can authorise the commission of criminal offences by informants.
However, they said "this does not mean that (MI5) has any power to confer immunity from liability under either the criminal law or the civil law."
Arguments in the case, heard before the Investigatory Powers Tribunal (IPT), covered the use of informants within the IRA and loyalist paramilitaries during the Troubles.
The four groups had wanted the policy guidance disclosed in full and ruled illegal.
In submissions to the tribunal, they said that "grave abuses" in Northern Ireland showed the public had a right to know.
They include allegations the state covered up its involvement in the 1989 murder of Belfast solicitor Pat Finucane, as well as actions of the agent in the IRA called 'Stakeknife'.
Lawyers for MI5 had said the policy guidance, revealed in 2018, was "critical" to national security.
IPT president Lord Justice Singh said that preventing MI5 from embedding an informant in a proscribed terrorist organisation because they would be committing a criminal offence "would strike at the core activities of the Security Service".
The judge said it was "essential to run an agent in a proscribed organisation... for the gathering of intelligence, but also for disrupting the activities of such organisations".
He added: "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."
Pointing out there were two dissenting judges, Daniel Holder, deputy director of the Committee on the Administration of Justice, said: "This is far from the end of the matter."
He added: "The practice of paramilitary informant involvement in serious crime was a pattern of human rights violations that prolonged and exacerbated the Northern Ireland conflict.
"Archival documents show that the unlawful nature of informant conduct here was known at the time and it appears policy since has been even more formalised."