WASHINGTON - A federal judge ordered the United States yesterday to publicly reveal unclassified versions of its allegations and evidence justifying the continued imprisonment of more than 100 detainees at Guantanamo Bay.

The Justice Department had been filing unclassified versions of its legal documents under seal, so that they could be seen only by judges, attorneys, and government officials. Attorneys for the detainees at the Navy base in Cuba could share the documents with their clients and witnesses who would agree to rules restricting the information's disclosure.

Justice officials said the practice was necessary to protect national security after they discovered that some unclassified records mistakenly contained some classified information. The department had said the documents were sealed only temporarily while they could be more carefully reviewed for classified information.

Attorneys for the detainees said that the secrecy made it more difficult for them to prepare for hearings, and that some witnesses would not agree to the court's secrecy rules.

The Associated Press, the New York Times, and USA Today had joined the fight, arguing that the government was keeping valuable information from a public that has a right to monitor the legal process.

U.S. District Judge Thomas Hogan sided with the detainees' attorneys and the media, saying the public had the right to access the records.

"Providing the public with access to the charges levied against these detainees, as detailed in the factual returns, ensures greater oversight of the detentions and these proceedings," Hogan said.

The judge ordered the Justice Department to publicly file its unclassified records or request what specific information it wanted to keep protected - marking the exact words with a colored highlighter - by July 29.

Justice spokesman Dean Boyd said the ruling was under review. He said the government had limited resources for classification and was using them to create declassified versions of the documents that detainees' attorneys could share with clients and witnesses.

Separately yesterday, a Canadian detainee at Guantanmo rejected his Pentagon-appointed attorneys at the first session of the war-crimes tribunals called at the base under President Obama, complicating his high-profile case and the administration's timeline for closing the prison.

Omar Khadr, 22, charged with killing an American soldier in Afghanistan in 2002, said he lost trust in his military lawyers after witnessing an ugly internal squabble that prompted the pretrial hearing. "How am I supposed to trust them if they are accusing each other?" Khadr said.

The judge set another hearing for July 13 in a long-running drama that suggests Obama's plan to close the offshore prison by January is overly optimistic.

Obama has pledged to keep the tribunals for at least some Guantanamo detainees, but the turmoil in a case once days away from trial shows how even small issues can stall the system for prosecuting terror suspects. Eleven detainees face charges, including five accused of orchestrating the Sept. 11 attacks.

Officials say the president is likely to need to extend his self-imposed deadline or move the trials elsewhere.

The chief prosecutor for the tribunals, Navy Capt. John Murphy, said his office was providing input on how the system might change if relocated to the United States.