The U.S. government, which has held Yaser Esam Hamdi incommunicado in a Navy brig for two years without charges, much of the time without a lawyer, indicated yesterday that it is nearing a deal that would free him altogether.

The government is negotiating with Hamdi's lawyers about "terms and conditions acceptable to both parties that would allow Mr. Hamdi to be released from . . . custody," according to documents filed in federal court in Norfolk. The legal papers, submitted jointly by federal prosecutors and Hamdi's attorneys, asked the court to stay all proceedings for 21 days while negotiations continue.

Terms of the release are still being hammered out but, according to people familiar with the situation, are likely to include that Hamdi renounce his U.S. citizenship, move to Saudi Arabia and accept some travel restrictions, as well as some monitoring by Saudi officials. In addition, he may have to agree not to sue the federal government over whether his civil rights were violated.

U.S. District Judge Robert G. Doumar in Norfolk has yet to rule on the request for a stay.

Hamdi was captured alongside pro-Taliban forces on the battlefield in northern Afghanistan in November 2001 and taken to the U.S. military prison at Guantanamo Bay, Cuba. There he told investigators that he was born in Louisiana to Saudi parents. He subsequently spent most of his life in Saudi Arabia, but his family said he never renounced his U.S. citizenship.

Hamdi was moved to the Navy jail at Charleston, S.C., in April 2002 and has been held there since as an enemy combatant. The government has not charged him.

In June, the Supreme Court ruled that as a U.S. citizen, Hamdi must have access to the U.S. legal system. All of the justices except Clarence Thomas rejected the Bush administration's contention that the federal courts could exercise no supervision over such a case.

"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," Justice Sandra Day O'Connor wrote in a passage of the ruling that seemed to summarize the dominant view of the court.

The indication that Hamdi might be released soon is "a huge embarrassment for the administration," said Michael Greenberger, a Justice Department official in the Clinton administration who is now a law professor at the University of Maryland.

"I think it's a bombshell," said Eugene R. Fidell, a Washington lawyer who specializes in military issues. "I think it's the type of thing that gets judges very, very upset," especially after the government had argued vigorously for more than two years to hold Hamdi, he said.

Frank W. Dunham Jr., the federal public defender who represents Hamdi, said the filing indicates that the negotiations over Hamdi's possible release "have reached the point where they're serious enough that both sides feel it's worth going into court and suggesting that maybe nothing ought to happen for a short period of time."

Dunham would not say how likely it is that Hamdi would be freed but added that he thinks the government "is operating in good faith and with a certain element of common sense."

Asked about possible terms of a release, a Justice Department official pointedly noted that Hamdi also holds citizenship in Saudi Arabia and that there are ample precedents for the conditional release of prisoners during wartime.

The only other U.S. citizen being held as an enemy combatant is Jose Padilla, who was arrested in May 2002 at Chicago's O'Hare Airport and has been accused of plotting to set off a radiological bomb in the United States and blow up apartment buildings here.

The Justice official said that it was possible to discuss releasing Hamdi if he "no longer has intelligence value or is no longer a threat to national security."

"It's been three years, and it's a different time," said the official, who spoke on the condition that fuller identification not be used. "So it is appropriate to look at the options."

But some experts in national security law dismissed that view. "I think that's cosmetic," said Scott L. Silliman, director of Duke University's Center for Law, Ethics and National Security. "I think what they're doing is saying that Hamdi . . . is a case we just want to move off the headlines and dockets."

The U.S. Court of Appeals for the 4th Circuit in Richmond issued a short order last week sending the Hamdi case back to Doumar. If a stay is not granted or Hamdi remains in custody, it remains unclear how further court proceedings in the case would develop.

Pentagon officials, considered a major force in pursuing the case, declined to comment yesterday. "I'm aware of the filing, but I don't have a comment for you," said Air Force Maj. Michael Shavers, a spokesman for the Defense Department's general counsel, William J. Haynes II. "The Department of Justice is taking the lead on this one."

Yaser Esam Hamdi, center, was captured alongside pro-Taliban forces in northern Afghanistan in 2001 and taken to the U.S. military prison at Guantanamo Bay, Cuba.