Updated

A federal judge dismissed a lawsuit by a German man who said he was illegally detained and tortured in overseas prisons run by the CIA, ruling that a lawsuit would improperly expose state secrets.

Thursday's ruling by U.S. District Judge T.S. Ellis III makes no determination on the validity of the claims by Khaled al-Masri, who said he was kidnapped on New Year's Eve 2003 and detained for nearly five months before finally being dumped on an abandoned road in Albania.

The ruling hands a victory to the Bush administration, which intervened in the civil lawsuit to prevent exposure of its tactics in the war on terrorism.

During his detention, al-Masri said he was beaten and sodomized with a foreign object by his captors. He also alleges that a CIA team forced him to wear a diaper and drugged him before a flight to an Afghan prison and refused to contact German authorities about his arrest.

Ellis said he was satisfied after receiving a secret written briefing from the director of central intelligence that allowing al-Masri's lawsuit to proceed would harm national security.

"In the present circumstances, al-Masri's private interests must give way to the national interest in preserving state secrets," Ellis wrote.

Al-Masri's lawsuit named former CIA Director George Tenet and three private companies that allegedly helped transport al-Masri from country to country.

The lawsuit says al-Masri was initially held for almost a month in Macedonia before being taken to a secret CIA prison in Kabul, Afghanistan, known as "the salt pit."

Al-Masri said the CIA knew shortly after his arrival in Kabul that he was a victim of mistaken identity. He further alleges that Secretary of State Condoleezza Rice knew by early May 2004 that al-Masri was mistakenly detained but that he was still not released until May 28.

Ben Wizner, a staff attorney for the American Civil Liberties Union, which is representing al-Masri, said he expects to file an appeal.

"We expect we will continue this fight in the courts," Wizner said.

He said it is absurd to think al-Masri's lawsuit would expose state secrets because many of the details of al-Masri's detention have been made public and confirmed by government sources in newspaper reports.

"There isn't really any dispute about what happened," Wizner said.

Judge Ellis' ruling "confers a blank check on the CIA to shield even the most outrageous conduct from judicial review," Wizner said.

Ellis did not describe what information he received that convinced him a lawsuit would expose state secrets and harm national security.

But he said he received a briefing labeled "JUDGE'S EYES ONLY" and that "it is enough to note here that al-Masri's publicly available complaint alleges a clandestine intelligence program." Ellis added that "any admission or denial of these allegations by defendants in this case would reveal the means and methods employed pursuant to this clandestine program and such a revelation would present a grave risk of injury to national security."

Ellis, at the end of his ruling, writes that "putting aside all the legal issues, if al-Masri's allegations are true or substantially true, then all fair-minded people ... must also agree that al-Masri has suffered injuries as the result of our country's mistake and deserves a remedy."

But Ellis said that remedy must come from Congress or the executive branch, not the judiciary.

Wizner said the Bush administration has not yet offered any financial settlement.

A Justice Department spokesman said the judge's ruling is under review and declined comment.