A U.S. citizen captured on the Afghanistan battlefield might soon be allowed to walk free after three years in custody, bringing an end to one of the Bush administration's longest and hardest-fought legal battles to arise from the war on terrorism.

Lawyers for the government and for Yaser Esam Hamdi (search) informed a federal judge Wednesday they've been negotiating his release since the Supreme Court said enemy combatants could not be indefinitely detained without legal rights.

In court papers filed jointly, the lawyers asked U.S. District Judge Robert G. Doumar to stay all proceedings in the case for 21 days so they can try to complete efforts to reach a mutually acceptable resolution.

"The thought is, what does he need any further legal proceedings for if the government agrees to release him?" Hamdi's attorney, federal public defender Frank Dunham Jr., said in a telephone interview.

Allowing Hamdi to walk free would represent a remarkable reversal of fortune for the White House, which had won its legal arguments in Hamdi's case in a lower court and had painted the Supreme Court ruling — when it first came down — as a partial victory.

As the first American citizen detained as an enemy combatant, Hamdi was the test case for what the Bush administration claimed was its prerogative to hold potentially dangerous terrorists for as long as necessary without charges or trial, and without the ordinary legal rights due an American citizen accused of a crime.

The legal fight over Hamdi was always about the scope of presidential power instead of the specifics of his case. Nonetheless, the administration called him a "classic battlefield detainee" captured with an automatic weapon and presumed to be a danger.

Dunham said he thinks an agreement to release Hamdi is close.

"I'm a fan of Yogi Berra," he added. "It's never over 'til it's over. The fact that we're talking to them and they're talking to us doesn't mean we've got an agreement."

Lawrence R. Leonard, the managing assistant U.S. attorney in Norfolk, did not immediately return calls seeking comment.

A Justice Department official, speaking on condition of anonymity because the case is pending before a court, said any prisoner of war or enemy combatant, including Hamdi, could be released when "they are determined to be of no further value and no longer a threat to the United States."

Although prosecutors could bring criminal charges against some such prisoners, that decision would depend on the evidence available and whether U.S. national security interests would be best served by having the person go on trial in open court, the official said.

But Michael Greenberger, who worked on counterterrorism projects in the Clinton administration's Justice Department, said letting Hamdi go now is a concession that the legal argument failed and that Hamdi himself is not a threat.

"I think if you went to mat on this and made it a cause celebre, refused him access to counsel and process and ... in the next breath you hear he may be released, that's a major embarrassment to the United States," Greenberger said.

The administration may also be cutting its losses, since a renewed federal court fight over Hamdi might result in another defeat for the government, Greenberger said.

Hamdi remains in the Navy brig in Charleston, S.C. He was transferred there from the brig in Norfolk.

Hamdi was born in Louisiana in 1980, while his Saudi father worked in the oil industry there. He grew up in Saudi Arabia. He was captured on the battlefield during the war with the Taliban (search) in Afghanistan in the fall of 2001.

Hamdi was sent to the Navy base at Guantanamo Bay (search), Cuba, before American authorities verified he was a U.S. citizen. The Department of Defense says 129 Guantanamo detainees have been released outright and 27 others have been released to the custody of other governments.

In its June 28 ruling, the Supreme Court said the war on terrorism does not give the government a "blank check" to hold a U.S. citizen and foreign-born terror suspects in legal limbo, a forceful denunciation of Bush administration tactics since the Sept. 11 attacks.

The ruling gave Hamdi the right to fight his detention in a federal court. The justices sent back to a lower court the case of another U.S. citizen in custody, Jose Padilla, the former Chicago gang member who was held as an enemy combatant amid allegations he sought to detonate a radiological "dirty bomb" in the United States.

John Walker Lindh (search), the American-born Taliban soldier captured in Afghanistan at roughly the same time as Hamdi, was almost immediately transferred from military custody and charged in a civilian court. He received a 20-year sentence in 2002 after pleading guilty to supplying services to Afghanistan's now-defunct Taliban government and carrying explosives in commission of a felony.