Mr. Marri is the only person on the American mainland known to be held as an enemy combatant. The government contended, in a declaration from the defense intelligence official, Jeffrey N. Rapp, that Mr. Marri was a Qaeda sleeper agent sent to the United States to commit mass murder and disrupt the banking system.  Mr. Marri was arrested on Dec. 12, 2001, in Peoria, Ill., where he was living with his family and studying computer science. He was charged with credit-card fraud and lying to federal agents, and was on the verge of a trial on those charges when he was moved to military detention in 2003.  Brian Roehrkasse, a Justice Department spokesman, said the decision properly recognized “the president’s authority to capture and detain Al Qaeda agents who, like the 9/11 hijackers, come to this country to commit or facilitate warlike acts against American civilians.”  Mr. Roehrkasse added that while the department believed that Mr. Marri “had already received all the process he was due,” its lawyers were “studying the court’s decision and will respond to Mr. Marri’s contentions” before the trial judge.  Jonathan L. Hafetz, a lawyer for Mr. Marri with the Brennan Center for Justice at the New York University School of Law, called the Fourth Circuit’s decision deeply disturbing.  “This decision means the president can pick up any person in the country — citizen or legal resident — and lock them up for years without the most basic safeguard in the Constitution, the right to a criminal trial,” Mr. Hafetz said.  The 216-page decision included seven opinions, none of which commanded a majority. The only common ground was four unsigned paragraphs at the beginning of the decision summarizing the result.  The Fourth Circuit is generally considered the nation’s most conservative federal appeals court. The closely divided and complex decision in a major terrorism case therefore came as something of a surprise.  Mr. Marri’s unusual situation played a role, said Robert M. Chesney, a law professor at Wake Forest University. Mr. Marri “was lawfully present in the U.S. and then arrested and held here, as opposed to being a noncitizen captured in a foreign land,” Professor Chesney said. “This consideration makes his case more difficult even in the eyes of relatively conservative jurists.”  The five judges who ruled that the president has the authority to detain people captured in the United States offered differing criteria for who might be subject to such detention.  Judge J. Harvie Wilkinson III said the president might detain members of organizations or nations against which Congress had authorized the use of force who mean to harm people or property to further military goals.  To reverse the trial judge’s decision allowing Mr. Marri’s detention to continue “because he was not captured on a foreign battlefield or foreign soil,” Judge Wilkinson wrote, “is akin to a judicial declaration that Congress and the executive may fight only the last war.”  Judge Diana Gribbon Motz, writing for herself and three other judges, disagreed, saying that Mr. Marri was at most a civilian criminal who may be prosecuted in the courts but not detained by the executive branch.  “This does not mean that al Marri, or similarly situated American citizens, would have to be freed,” Judge Motz wrote. “Like others accused of terrorist activity in this country, from the Oklahoma City bombers to the convicted September 11th conspirator [Zacarias Moussaoui] they could be tried on criminal charges and, if convicted, punished severely. But the government would not be able to subject them to indefinite military detention.”  Judge William B. Traxler Jr. was the swing vote. He agreed that Mr. Marri was subject to detention if what the government said about him was true. But Judge Traxler broke with the judges who voted against Mr. Marri across the board. Those judges said Mr. Marri had already had an adequate opportunity to challenge his detention in court, in the proceeding based on Mr. Rapp’s statement. Judge Traxler said that Mr. Marri must be given a fair and meaningful opportunity to see and refute “the most reliable evidence” against him, subject to national security and other concerns.  The four judges who would have ordered Mr. Marri’s release from military custody — Judges Motz, Roger L. Gregory, M. Blaine Michael and Robert B. King — agreed to join an order returning the case to the trial court based on Judge Traxler’s middle ground. They did so, Judge Motz wrote, “to give practical effect to the conclusions of the majority of the court who reject the government’s position.”  But Judge Gregory expressed frustration over the net effect of the exercise. “There is no concrete guidance as to what further process is due” Mr. Marri, he wrote.  All of the judges who would have denied Mr. Marri any relief — Judges Wilkinson, Karen J. Williams, Paul V. Niemeyer and Allyson K. Duncan — were appointed by Republican presidents; all who would have granted him full relief were appointed by Democrats. Judge Traxler was appointed to the appeals court by President Bill Clinton.  In the conclusion of his long opinion, Judge Wilkinson said terrorism cases presented courts with special challenges.  “We may never know,” he said, “whether we have struck the proper balance between liberty and security, because we do not know every action the executive is taking and we do not know every threat global terror networks have in store.”  A version of this article appears in print on , on Page A12 of the New York edition with the headline: Court Ruling Favors Bush In Powers On Detainees. Order Reprints| Today's Paper|Subscribe
A court said the president has the legal power to order the indefinite detentions of civilians captured in the U.S.