The Supreme Court struck down key elements of the Bush administration's legal policy for its battle against terrorism yesterday, ruling in two cases that the executive branch does not have the authority to deprive accused members of al Qaeda or the Taliban of their liberty without giving them a day in court.

The court said the president may order a U.S. citizen detained as an "enemy combatant" -- but it soundly rejected the administration's expansive interpretation of that authority, ruling that such detainees are entitled to contest the government's case against them.

The court also ruled that each of the 595 alleged members of al Qaeda and the Taliban being held at the U.S. naval base in Guantanamo Bay, Cuba, has the right to ask a U.S. judge to set him free.

In a third case -- that of Jose Padilla, a U.S. citizen who is accused of taking part in an al Qaeda plot to explode a radiological bomb in the United States -- the court ruled that he would have to resubmit his petition for habeas corpus because his attorney filed it in the wrong court.

The courtroom atmosphere was tense as justices read a series of much-anticipated opinions, elaborating their strongly felt views on cases that had raised the most significant wartime civil liberties issues since World War II. Those opinions left open questions about the precise scope and practical effect of what the court had done.

But the court's bottom line was clear: Insofar as it affects individual constitutional rights, the president's conduct of the fight against terrorism is not immune to judicial review.

"Striking the proper constitutional balance here is of great importance to the Nation during this period of ongoing combat," Justice Sandra Day O'Connor wrote, in a passage that seemed to summarize the dominant view of the court. "But it is equally vital that our calculus not give short shrift to the values that this country holds dear or to the privilege that is American citizenship. It is during our most challenging and uncertain moments that our Nation's commitment to due process is most severely tested; and it is in those times that we must preserve our commitment at home to the principles for which we fight abroad."

She added: "We have long since made clear that a state of war is not a blank check for the President when it comes to the rights of the Nation's citizens."

Civil liberties organizations and their allies in Congress hailed the decisions, saying the court had validated their claims that, since Sept. 11, 2001, the Bush administration has been sacrificing too much liberty in the name of national security.

"The Supreme Court's decisions in the Hamdi case and the case involving the Guantanamo detainees are triumphs for the rule of law," House Minority Leader Nancy Pelosi (D-Calif.) said in a statement. "The notion that the President has the unchallengeable authority to define the circumstances of a person's detention, especially that of a United States citizen, is contrary to our nation's history and experience."

The Bush administration emphasized that the court had recognized that it may detain U.S. citizens as enemy combatants, albeit under more limited circumstances.

"The Justice Department is pleased that the U.S. Supreme Court today upheld the authority of the President as Commander-in-Chief of the armed forces to detain enemy combatants, including U.S. citizens," department spokesman Mark Corallo said in a statement. "This authority is crucial in times of war whether the enemy combatants are individuals who join our enemies on the battlefield to fight against America and its allies, or whether they are individuals who infiltrate our border to commit hostile and war-like acts against our nation."

In Hamdi v. Rumsfeld, No. 03-6696, the issue was whether President Bush could declare Yaser Esam Hamdi, a U.S. citizen who was arrested while allegedly fighting for the Taliban in 2001, an enemy combatant and order him detained indefinitely by the military.

The Bush administration cited both the president's inherent powers to conduct war and the Sept. 18, 2001, congressional resolution allowing him to use "all necessary and appropriate force" against al Qaeda and the Taliban.

But at the Supreme Court, only Justice Clarence Thomas embraced those claims yesterday.

Justice Antonin Scalia, joined by Justice John Paul Stevens, wrote that the Constitution forbids the president from doing anything but charging Hamdi with a crime such as treason or releasing him, unless Congress specifically authorizes executive detention. Justice David H. Souter, joined by Justice Ruth Bader Ginsburg, reached a similar conclusion, but based on the argument that the Sept. 18 resolution did not clearly state Congress's intent to override a 1971 federal statute barring executive detention.

A four-justice plurality of the court -- Chief Justice William H. Rehnquist, O'Connor, and Justices Anthony M. Kennedy and Stephen G. Breyer -- acknowledged that the president did have authority to designate citizens as enemy combatants, under the Sept. 18 resolution and a 1942 Supreme Court ruling that approved of the designation of a U.S. citizen fighting for Nazi Germany as an enemy combatant.

Such authority "is so fundamental and accepted an incident to war as to be an exercise of the 'necessary and appropriate force' Congress has authorized the President to use," O'Connor wrote for the group.

But the plurality concluded that the president must exercise that authority in keeping with the constitutional guarantee of due process, affording Hamdi access to a lawyer and "a fair opportunity to rebut the Government's factual assertions before a neutral decisionmaker," as O'Connor's opinion put it.

Thus, those four, plus Thomas, formed a majority of five for the proposition that U.S. citizens could be held as enemy combatants.

But there was a six-vote majority for the part of the plurality opinion that outlined a hearing for Hamdi; Souter and Ginsburg agreed to vote for it, while Thomas declined.

Scalia and Stevens wanted no part of such a compromise. Reading his opinion from the bench in a show of strong disagreement with the plurality, Scalia said that "if civil rights are to be curtailed during wartime, it must be done openly and democratically, as the constitution requires, rather than by silent erosion through an opinion of this court."

It was unclear exactly what sort of legal process the court had created for Hamdi. In a nod to the administration, the plurality recommended that the usual presumption of innocence be suspended, and that the government be permitted to introduce hearsay evidence. It even suggested that in other future enemy-combatant cases involving U.S. citizens, a military tribunal might suffice, though the Bush administration has declined to use such tribunals against citizens.

But Souter and Ginsburg withheld their approval for those parts of the opinion, so they lack the backing of a court majority.

Ultimately, O'Connor left it up to district judges to fashion "a fact-finding process that is both prudent and incremental."

Supporters of the administration said this favored them.

"They are basically upholding the whole enemy combatant status and tweaking the evidence test," said David B. Rivkin Jr., a lawyer who has advised the administration on terrorism issues. "The only difference I can see is that you are entitled to have you or your lawyer give your side of the story."

Still, the net effect was to end what some legal analysts had seen as the administration's attempt to create a parallel legal system for terrorism cases, separate from ordinary criminal justice and controlled almost exclusively by the executive.

"The Hamdi decision was better than the human rights and civil liberties groups asked for," said Joseph N. Onek, director of the Liberty and Security Initiative of the Constitution Project, a Washington-based civil liberties organization.

The court's decision to throw out Padilla's case on jurisdictional grounds was by a 5 to 4 vote.

The court ruled that his attorney incorrectly went to a New York court in search of an order releasing him after the government had moved him to a South Carolina brig.

But unless the Justice Department decides to charge Padilla, it seemed likely that there will be five votes to let him go once his case comes back up. Four justices -- Stevens, Souter, Ginsburg and Breyer -- dissented from the court's refusal to decide his case yesterday, while Scalia is on record in the Hamdi case as opposing the administration's approach to enemy combatants generally.

As Stevens read his dissent from the court's procedural ruling against Padilla yesterday, his voice quavered. He hinted that the recent revelations of administration planning for harsh interrogations of terrorism detainees and abuse at the Abu Ghraib prison in Iraq had an impact inside the court.

Referring to Padilla's two years of incommunicado detention as a "form of torture," Stevens said that "if this Nation is to remain true to the ideals symbolized by its flag, it must not wield the tools of tyranny even to resist an assault by the forces of tyranny."

In two consolidated cases, Rasul v. Bush, No. 03-334, and al Odah v. Rumsfeld, No. 03-343, which were brought by family members of 16 British, Australian and Kuwaiti citizens currently or formerly held in the U.S. prison at Guantanamo Bay, this issue was whether the detainees may seek their freedom in U.S. courts by applying for a writ of habeas corpus.

The detainees were not charged with crimes or permitted direct contact with lawyers, and attorneys for their families called the prison a U.S.-created "lawless enclave."

Even before recent revelations that the Bush administration contemplated using harsh interrogation tactics on certain detainees there, Guantanamo had turned into a major international issue.

The administration argued that the naval base is still formally a part of Cuba, and thus outside U.S. court jurisdiction.

In response to diplomatic pressure and military determinations that some detainees are no longer dangerous, the Bush administration has released 146 prisoners from Guantanamo in the past two years, including the two British citizens involved in this case, though 12 of those released are in custody in their home countries. The administration has named six detainees for trial before a military tribunal.

But by a vote of 6 to 3 yesterday, the court said that is not good enough. Stevens wrote for the majority that federal law permits U.S. courts to entertain the prisoners' habeas corpus petitions.

The Bush administration had relied on a 1950 Supreme Court ruling that said foreign prisoners held outside the United States in connection with a war are not eligible for habeas corpus. But a subsequent Supreme Court ruling had overturned that, Stevens wrote.

Stevens left it for the lower courts to answer the question of "whether and what further proceedings may become necessary." His opinion also did not define the intended geographical scope of the ruling. The case as presented to the court concerned only the Cuba base, but Scalia, raising the prospect of lawsuits by prisoners in Iraq and Afghanistan, noted in dissent that the logic of Stevens's opinion "boldly extends the scope of the habeas statute to the four corners of the earth."

The Supreme Court ruled that alleged terrorists held at the U.S. naval base in Guantanamo Bay, Cuba, have the right to ask a U.S. judge to free them.In a case involving Yaser Esam Hamdi, left, a U.S. citizen arrested while allegedly fighting for the Taliban in 2001, the Supreme Court ruled that detainees must be allowed access to a lawyer and a trial.