British spies can keep some evidence secret from former Guantanamo prisoners who are suing the government for alleged complicity in their detention, a British judge ruled Wednesday, the first volley in a legal battle to expose what role Britain played in the men's imprisonment.

Seven ex-Guantanamo inmates allege they were tortured or abused at the U.S. prison camp and elsewhere — and that the British government contributed to their torment. Their civil suit seeking damages from the spy agencies MI5 and MI6 and other government bodies has yet to come to trial, but the government won a preliminary victory by securing the right to keep selected pieces of information from the men and their lawyers.

Justice Stephen Silber warned that his ruling was a "stark question of law, not related to the facts of the case." He said lawyers would still have to work with any future trial judge to decide which evidence, if any, could be kept under wraps.

Government lawyer Jonathan Crow said officials were likely to invoke the "closed material procedure" to protect sensitive evidence. In that case, the material could support the government's case but could only be reviewed by a specially appointed lawyer who could not discuss it with the former inmates or their attorneys.

Similar arrangements exist to keep classified government material from opposing counsel in the United States and Canada.

The former Guantanamo detainees had opposed the procedure, arguing that not allowing them access to government evidence would be unfair and contrary to the principles of open justice.

Michael Fordham, their lawyer, said they would appeal the ruling as quickly as possible but he also noted that the government had claimed it could take until next year to decide which evidence it wanted to keep secret.

Fordham's clients are Binyam Mohamed, an Ethiopian-born Guantanamo inmate who was released earlier this year; Libyan-born Omar Deghayes, Iraqi Bisher al-Rawi and Palestinian-Jordanian Jamil el-Banna, all British residents who were released in 2007; Moazzam Begg, released in 2005; as well as Britons Martin Mubanga and Richard Belmar.