David Cameron is tomorrow expected to announce the terms of a long-promised, judge-led inquiry into allegations of MI5's complicity in the torture of terror suspects and into how British citizens and residents are to be compensated for being detained at Guantánamo Bay.

The security and intelligence agencies, supported by senior Whitehall officials, have fought to limit the scope and nature of an inquiry, which they have argued must be held in private. Key questions will be how broad the terms of reference will be and the latitude given to the individual with the task of presiding over the inquiry, officials and lawyers said.

The agencies have also said that any inquiry would have to await a civil trial in which British residents and citizens held in Guantánamo Bay are seeking compensation from MI5 and MI6. In May the court of appeal dismissed an attempt by MI5 and MI6 to suppress evidence of alleged complicity in torture, ruling that such an unprecedented legal move undermined the principles of common law and open justice.

In the appeal court ruling Lord Neuberger, master of the rolls, Lord Justice Maurice Kay and Lord Justice Sullivan said that accepting the argument of the security and intelligence agencies would amount to "undermining one of [the common law's] most fundamental principles". One of those principles was that "trials should be conducted in public, and the judgments should be given in public".

The appeal court's ruling meant that if a trial went ahead MI5 and MI6 would have had to disclose evidence about their involvement or knowledge of the detainees' treatment. They are expected to offer out-of-court compensation totalling millions of pounds instead.

It was reported last month that the government was considering a limited inquiry into the British role in the rendition to Guantánamo of the six men. According to the reports, Cameron had already concluded that the UK's intelligence agencies had made "errors of omission rather than commission".

Such a narrow remit would not satisfy those individuals who were tortured overseas after being detained in British counter-terrorism operations since 2001, and would leave unanswered questions about British logistical support for the CIA's rendition programme and about orders that led to British special forces in Iraq and Afghanistan handing people over to US forces, despite fears they would be tortured. It would also expose the government to continuing questioning about the use of torture by British troops in Iraq, which led to a number of deaths, and is alleged to have been systemic and apparently condoned at a high level.

Liberal Democrat members of the government will be conscious that last autumn their party conference passed a resolution demanding "a full and independent public inquiry". In addition to facing criticism from their party's rank and file if the agreed terms fall far short of this, they will also face criticism from many Tory backbenchers who have been campaigning for an inquiry. "They wouldn't want that," said one prominent Tory MP, "especially not after the budget."

The government is also likely to say that an inquiry will have no bearing on any decision by the Crown Prosecution Service relating to an MI5 officer and an MI6 officer whose alleged complicity in the abuse of detainees has been investigated by the Metropolitan police for more than a year.