By Richard Allen Greene
BBC News, Washington
The Supreme Court has pulled the rug out from under President George W Bush in dramatic fashion with its ruling that he has no authority to try terror suspects in military tribunals.
And in his first public appearance after the announcement - alongside Japan's Junichiro Koizumi - he showed how rattled he was by the news.
Mr Bush refused to go into detail about the consequences
"It was not always a given that the United States and America would have a close relationship," he said, confusing names as he tried to highlight the remarkable turnaround in relations between the US and Japan since World War II.
And his annoyance showed a moment later when not just one but two reporters asked him about the ruling.
He said he had not had time to take it in, finishing his answer to the second journalist with: "I'm sorry you wasted your question."
But while the 5-3 decision on the prisoners at Guantanamo Bay may have thrown the president off his stride, his Senate allies soon showed they were prepared to leap hurdles to support him.
Bill Frist - Mr Bush's personal choice to lead the Republicans in the Senate, and a man who hopes to replace him in the White House - declared that he would press for a law giving the president the power to do what the Supreme Court said he could not.
Sen Arlen Specter, a moderate Republican who chairs the powerful judiciary committee, moved even faster.
Lawmakers rallied to the president's side
Within hours of the Supreme Court ruling, he introduced an "Unprivileged Combatant Act" which would, he said, balance "the need for national security with the need to afford detainees with sufficient due process".
Predictably, defenders of the roughly 450 detainees at Guantanamo Bay hailed the Supreme Court ruling.
"Any real lawyer who isn't part of the administration knows this violates the Geneva Conventions," said Michael Mori, a military lawyer defending Guantanamo detainee David Hicks.
But the president has made it clear that he will continue trying to find a way to try the detainees by military tribunal rather than releasing them, giving them courts martial or prosecuting them in the civilian court system.
No early release
And even some of his critics implicitly concede that a change in the law may make that possible.
Democratic Sen Carl Levin said in a statement that the court ruling "firmly and appropriately establishes that the president acting alone lacks the power to unilaterally determine basic legal rights of detainees at Guantanamo Bay".
But note the caveats about the president "acting alone" and "unilaterally".
The ruling may mean detainees remain even longer
Sen Levin seems to leave open the possibility that Congress could change the law to support the president - as, indeed, the Supreme Court did in its finding.
The court's ruling was about the powers of the president, not - technically - about the treatment of the detainees, and certainly not about the authority of Congress.
Whatever the administration's next move, the Supreme Court ruling does nothing to speed the release of the detainees.
In fact, Bush spokesman Tony Snow said it might do just the opposite, keeping them there longer as the White House tries to figure out how to move forward.
Part of the problem is that it does not know what to do even with those it would like to release.
The US is afraid some will face torture in their own countries if they are sent home.
Others, it fears, will engage in attacks on Americans targets if they are freed.
And it remains determined to try some in military tribunals rather than open court so as not to reveal classified information.
In theory, the Supreme Court verdict gives the White House the option of doing nothing, simply leaving the men in Guantanamo indefinitely.
But that would definitely be challenged in court.
In fact, the Supreme Court decision may have opened the way for challenges to other aspects of the "Global War on Terror", such as the alleged mistreatment of prisoners from Guantanamo to Abu Ghraib, Marty Lederman of Georgetown University Law school said.
The ruling explicitly said the Geneva Conventions apply to the detainees at Guantanamo Bay - something the administration has steadfastly denied.
"The [military] commissions are the least of it," Mr Lederman wrote in his Supreme Court blog.
"This almost certainly means that the CIA's interrogation regime is unlawful, and indeed, that many techniques the Administration has been using, such as waterboarding and hypothermia (and others) violate the War Crimes Act."
Other analysts have speculated that the ruling may have implications for the administration's surveillance of banking transfers and phone calls.
In other words, the White House may suddenly find itself fighting a raft of new legal battles as it prosecutes its ongoing war on terror.