'New evidence'

Anand Naidoo, Al Jazeera's correspondent who was at the court, said: "The judge said that she wants the detainee to be freed 'promptly' - that was the word that she used.

In depth

 

Pictures: Faces of Guantanamo

 

Video: Guantanamo: The legacy of Camp X-Ray

  Video: Move to close Guantanamo faces hitches
  Video: Freed inmate recounts ordeal
  Smalltown USA's Guantanamo hopes
  Faultlines: Bush's torture legacy
  Faultlines: Obama's war on terror
  Witness: A strange kind of freedom

"There will be a fifteen-day waiting period and then justice department officials have to inform congress that the detainee is about to be released; that is a legal requirement.

"Justice officials say that process could take seven days, so at best it could be 22 days before Jawad is released."

But while Huvelle has ordered Jawad's release, the US justice department has said that it is continuing with a criminal investigation against the detainee after receiving new evidence in the case.

Eric Holder, the US attorney general, is still considering whether or not to formally indict Jawad, who allegedly injured two US soldiers and their interpreter in a grenade attack.

Should Jawad be charged, it would leave open the possibility of him being brought to the US for a criminal trial.

Huvelle urged prosecutors to take into account a number of issues in the case, such as Jawad's mental competency to stand trial after more than six years' detention without charge.

"After this horrible, long, tortured history, I hope the government will succeed in getting him back home," she said.

"Enough has been imposed on this young man to date."

Confession rejected

Lawyers for Jawad says that he was about 12 years old when he was arrested in December 2002.

The Pentagon has said that he was about 17 years old when he was taken into detention, pointing to a scan of his bones as evidence.

David Frakt, Jawad's military-appointed atorney, said that the case against Jawad had no foundation.

"This is the first detainee who was actually charged in the military commissions and was on the verge of trial and is now to be released," he said.

"This is one of the people Bush administration falsly labelled the worst of the worst, and now the truth has come out: [he was] tortured by the US, mistreated, [and] spent virtually his entire adolescene in Guantanamo."

Jawad's lawyers say that his confession to throwing the grenade came after
Afghan officials threatened to kill him and members of his family.

But in October, a US military judge ruled in October that the confession was inadmissible in military tribunals at Guantanamo as it had been extracted through torture.

The US justice department has said it would use any of Jawad's statements during interrogations by Afghan or US officials in any criminal case against him.