On January 10 2002, a US military cargo plane landed at a US naval base in southeastern Cuba after a 27-hour flight from Afghanistan with 20 men aboard, shackled, handcuffed and blinded by blacked-out safety goggles. They were the first captives of the war on terror - "the worst of the worst", US military officials said. Their arrival in Guantánamo Bay founded a prison regime that has been condemned around the world - and that now, four years on, could be on the verge of closure. More than 750 inmates have passed through the steel mesh cages since the Bush administration decided to establish an offshore prison that would be beyond the reach of the US constitution and international law, where inmates would be subjected to open-ended interrogation and tried before military tribunals without the protection of the Geneva convention.

But it now appears that the White House has decided that America can no longer afford the damage to its reputation and its relations around the world. Within the last two weeks, George Bush has said three times that he would like to close the camp, but was waiting for direction from the US supreme court. "I'd like to end Guantánamo. I'd like it to be over with," the president said on Wednesday after meeting European Union leaders in Vienna.

The court is expected to hand down a verdict next week that could outlaw the controversial military tribunals set up by the administration to try the inmates, and so demolish the legal foundations on which the detention regime was built. Several of the lawyers who have fought for the detainees to get their day in court say they see that ruling as a pretext for the administration to rid itself of a regime that long ago became a liability. "When the president asks the supreme court to tell him that the detentions are illegal ... that means he wants to shut it down and is looking for ways to do it," said Bill Goodman, legal director of the Centre for Constitutional Rights, representing more than 100 detainees.

Repatriation

The end is likely to come quietly. The prison population is already on the wane. No new inmates have arrived since September 2004, and the Pentagon says it intends to transfer 120 of the current 460 to their home countries. Sources said this week that arrangements were under way for the repatriation of the largest group of Saudi inmates in the history of the camp.

David Remes, who represents 17 Yemenis, believes that Guantánamo outlived its utility to the administration in 2004 when the supreme court ruled, in an earlier case, that inmates were entitled to challenge their detention in US courts. That, said Mr Remes, was the beginning of the end.

"Because Guantánamo can no longer serve its purpose, and because Guantánamo has become a symbol that contradicts everything the administration is trying to accomplish in the world, I think the administration would love nothing more, at this point, than to close it down and release most prisoners," he said.

Others describe Guantánamo as an "impulse buy" the administration soon regretted. The camp's first commander had 96 hours' notice to transform an ancient holding pen for Haitian and Cuban refugees to a high security prison for al-Qaida suspects.

"The Bush administration boxed itself into a corner by the choices it made in treating the people at Guantánamo," said David Cole, a law professor at Georgetown University. "Had it given individuals hearings at the outset to ensure they were, in fact, fighters for al-Qaida, had it treated them humanely while they were detained there, rather than coercively interrogating them, and had it asserted the authority to hold them only for the duration of the conflict with al-Qaida - rather than the duration of the war on terror, which is never ending - I don't think Guantánamo would be a problem."

But the practicalities of dismantling the prison are daunting. For Guantánamo to go, prisoners must be brought to trial, or released. So far, only 10 have been formally charged by the much-maligned military tribunals. A study this year by a New Jersey law school found 90% of the inmates had nothing to do with terrorism. That means America must now release scores of men who, while innocent, have been branded as terrorists by virtue of their long stay at Guantánamo. While the majority are from Afghanistan, Saudi Arabia and Yemen, there are also smaller contingents from two dozen smaller countries. So where do the former inmates go?

So far, the process of repatriating prisoners has been painfully slow, say detainee lawyers. In part, countries are nervous about taking back prisoners whom the US has labelled dangerous terrorists. They are also frustrated with the stonewalling of US military officials when asked for evidence of links to al-Qaida. But the host countries may also see America's eagerness to rid itself of Guantánamo as a bargaining opportunity. Some of the prisoners are citizens of countries where torture is routine. If they return home carrying the stigma of Guantánamo, their lives could be in danger. America has indicated it will not take any of the detainees - even those it admits are innocent.

European countries also appear unwilling. It took the US authorities nearly two and a half years to find a safe haven for five entirely innocent Chinese Muslims it had been holding at Guantánamo. The men were finally released last month in Albania. Human rights activists foresee similar problems for Libyans.

Hands tied

If they are to be brought to trial, in what court? It is highly unlikely that, after years of resistance, the administration would support trials of the Guantánamo detainees in US courts. "They have tied both hands behind their back by holding them there, because it rendered everything they have said inadmissible in a US court," said John Sifton of Human Rights Watch.

It may allow them to be tried before military courts under rules set down by US military law and in compliance with the Geneva convention, but - given Guantánamo's history - those may not be seen as legitimate by other countries, said Clive Stafford Smith, who represents a Moroccan detainee.

But if Guantánamo does close, what then? Over the last few years, America has moved its detention centres in the war on terror even further offshore to Poland and Romania, as well as to other secret locations where some 30 high-level al-Qaida prisoners are believed to be held. Closing Guantánamo will not bring those detainees closer to a courtroom, or spare them from possible abuse. "They want to shut it down so they can create hundreds of small Guantánamo Bays that will not attract attention or serve as such a symbol," said Jonathan Turley, a law professor at George Washington University. "The president has not said he wants to stop the policies that created it ... there is no indication the administration wants to comply with domestic or international law in the treatment of detainees."