A top-secret document revealing how MI6 and MI5 officers were allowed to extract information from prisoners being illegally tortured overseas has been seen by the Guardian.

The interrogation policy – details of which are believed to be too sensitive to be publicly released at the government inquiry into the UK's role in torture and rendition – instructed senior intelligence officers to weigh the importance of the information being sought against the amount of pain they expected a prisoner to suffer. It was operated by the British government for almost a decade.

A copy of the secret policy showed senior intelligence officers and ministers feared the British public could be at greater risk of a terrorist attack if Islamists became aware of its existence.

One section states: "If the possibility exists that information will be or has been obtained through the mistreatment of detainees, the negative consequences may include any potential adverse effects on national security if the fact of the agency seeking or accepting information in those circumstances were to be publicly revealed.

"For instance, it is possible that in some circumstances such a revelation could result in further radicalisation, leading to an increase in the threat from terrorism."

The policy adds that such a disclosure "could result in damage to the reputation of the agencies", and that this could undermine their effectiveness.

The fact that the interrogation policy document and other similar papers may not be made public during the inquiry into British complicity in torture and rendition has led to human rights groups and lawyers refusing to give evidence or attend any meetings with the inquiry team because it does not have "credibility or transparency".

The decision by 10 groups – including Liberty, Reprieve and Amnesty International – follows the publication of the inquiry's protocols, which show the final decision on whether material uncovered by the inquiry, led by Sir Peter Gibson, can be made public will rest with the cabinet secretary.

The inquiry will begin after a police investigation into torture allegations has been completed.

Some have criticised the appointment of Gibson, a retired judge, to head the inquiry because he previously served as the intelligence services commissioner, overseeing government ministers' use of a controversial power that permits them to "disapply" UK criminal and civil law in order to offer a degree of protection to British intelligence officers committing crimes overseas. The government denies there is a conflict of interest.

The protocols also stated that former detainees and their lawyers will not be able to question intelligence officials and that all evidence from current or former members of the security and intelligence agencies, below the level of head, will be heard in private.

The document seen by the Guardian shows how the secret interrogation policy operated until it was rewritten on the orders of the coalition government last July.

It also:

• Acknowledged that MI5 and MI6 officers could be in breach of both UK and international law by asking for information from prisoners held by overseas agencies known to use torture.

• Explained the need to obtain political cover for any potentially criminal act by consulting ministers beforehand.

The secret interrogation policy was first passed to MI5 and MI6 officers in Afghanistan in January 2002 to enable them to continue questioning prisoners whom they knew were being mistreated by members of the US military.

It was amended slightly later that year before being rewritten and expanded in 2004 after it became apparent that a significant number of British Muslims, radicalised by the invasion of Iraq, were planning attacks against the UK.

The policy was amended again in July 2006 during an investigation of a suspected plot to bring down airliners over the Atlantic.

Entitled "Agency policy on liaison with overseas security and intelligence services in relation to detainees who may be subject to mistreatment", it was given to intelligence officers handing over questions to be put to detainees.

Separate policy documents were issued for related matters, including intelligence officers conducting face-to-face interrogations.

The document set out the international and domestic law on torture, and explained that MI5 and MI6 do not "participate in, encourage or condone" either torture or inhuman or degrading treatment.

Intelligence officers were instructed not to carry out any action "which it is known" would result in torture. However, they could proceed when they foresaw "a real possibility their actions will result in an individual's mistreatment" as long as they first sought assurances from the overseas agency.

Even when such assurances were judged to be worthless, officers could be given permission to proceed despite the real possibility that they would committing a crime and that a prisoner or prisoners would be tortured.

"When, not withstanding any caveats or prior assurances, there is still considered to be a real possibility of mistreatment and therefore there is considered to be a risk that the agencies' actions could be judged to be unlawful, the actions may not be taken without authority at a senior level. In some cases, ministers may need to be consulted," the document said.

In deciding whether to give permission, senior MI5 and MI6 management "will balance the risk of mistreatment and the risk that the officer's actions could be judged to be unlawful against the need for the proposed action".

At this point, "the operational imperative for the proposed action, such as if the action involves passing or obtaining life-saving intelligence" would be weighed against "the level of mistreatment anticipated and how likely those consequences are".

Ministers may be consulted over "particularly difficult cases", with the process of consulting being "designed to ensure that appropriate visibility and consideration of the risk of unlawful actions takes place". All such operations must remain completely secret or they could put UK interests and British lives at risk.

Disclosure of the contents of the document appears to help explain the high degree of sensitivity shown by ministers and former ministers after the Guardian became aware of its existence two years ago.

Tony Blair evaded a series of questions over the role he played in authorising changes to the instructions in 2004, while the former home secretary David Blunkett maintained it was potentially libellous even to ask him questions about the matter.

As foreign secretary, David Miliband told MPs the secret policy could never be made public as "nothing we publish must give succour to our enemies".

Blair, Blunkett and the former foreign secretary Jack Straw also declined to say whether or not they were aware that the instructions had led to a number of people being tortured.

The head of MI5, Jonathan Evans, said that, in the post 9/11 world, his officers would be derelict in their duty if they did not work with intelligence agencies in countries with poor human rights records, while his opposite number at MI6, Sir John Sawers, spoke of the "real, constant, operational dilemmas" involved in such relationships.

Others, however, are questioning whether – in the words of Ken Macdonald, a former director of public prosecutions, "Tony Blair's government was guilty of developing something close to a criminal policy".

The Intelligence and Security Committee, the group of parliamentarians appointed by the prime minister to assist with the oversight of the UK's intelligence agencies, is known to have examined the document while sitting in secret, but it is unclear what – if any – suggestions or complaints it made.

Paul Murphy, the Labour MP and former minister who chaired the committee in 2006, declined to answer questions about the matter.

A number of men, mostly British Muslims, have complained that they were questioned by MI5 and MI6 officers after being tortured by overseas intelligence officials in Pakistan, Bangladesh, Afghanistan and Guantánamo Bay. Some are known to have been detained at the suggestion of British intelligence officers.

Others say they were tortured in places such as Egypt, Dubai, Morocco and Syria, while being interrogated on the basis of information that could only have been supplied by the UK.

A number were subsequently convicted of serious terrorism offences or subjected to control orders. Others returned to the UK and, after treatment, resumed their lives.

One is a businessman in Yorkshire, another a software designer living in Berkshire, and a third is a doctor practising on the south coast of England.

Some have brought civil proceedings against the British government, and a number have received compensation in out-of-court settlements, but others remain too scared to take legal action.

Scotland Yard has examined the possibility that one officer from MI5 and a second from MI6 committed criminal offences while extracting information from detainees overseas, and detectives are now conducting what is described as a "wider investigation into other potential criminal conduct".

A new set of instructions was drafted after last year's election, published on the orders of David Cameron, on the grounds that the coalition was "determined to resolve the problems of the past" and wished to give "greater clarity about what is and what is not acceptable in the future".

Human rights groups pointed to what they said were serious loopholes that could permit MI5 and MI6 officers to remain involved in the torture of prisoners overseas.

Last week, the high court heard a challenge to the legality of the new instructions, brought by the Equality and Human Rights Commission. Judgment is expected later in the year.