As one of his first acts in the White House, Barack Obama is preparing to move hundreds of detainees from Guantanamo Bay prison to the US where they will be given legal hearings, trials or face yet-to-be-established special terrorist courts.
Mr Obama has a long-standing commitment to shut down Guantanamo, which has become a symbol of injustice for human rights campaigners, and a lightning rod for anti-US criticism since it opened eight years ago. Closing the prison, which is on a part of Cuba leased to the US, will bring to an end one of the most poisonous legacies of the Bush administration while sending a signal that the "war on terror" is under more enlightened management.
During his election campaign, Mr Obama described Guantanamo and the CIA's secret prisons around the world as a "sad chapter in American history". Other aspects of Mr Bush's "war on terror" will also demand Mr Obama's urgent attention such as yesterday's revelation by the New York Times that the US military has, during the past four years, conducted up to a dozen secret raids in Pakistan and other countries not at war with the US. Mr Obama has previously said he would approve such raids against enemies such as Osama bin Laden if there no other option was available.
Mr Obama's plans for Guantanamo inmates should see most detainees, against whom there is little or no evidence, being released to their home countries after years in legal limbo. Others will face prosecution in US criminal courts. One problem for those courts will face is deciding whether evidence from anonymous intelligence sources or obtained without any legal process can be taken into account. Some Guantanamo inmates suffered torture or other abusive treatment at the hands of CIA interrogators either at the prison or after they were picked up in security sweeps in Afghanistan or Pakistan. A few have been through the controversial military commissions process, from which even prosecutors have resigned. The US Supreme Court has several times rebuked the Bush administration for its handling of the detainees.
Kept in isolation in harsh conditions, a number of inmates have become mentally and physically ill. At least four men are believed to have committed suicide inside Guantanamo and others have endured force-feeding after going on hunger strike.
Of the estimated 255 inmates still held at the prison, fewer than 49 are acknowledged to be hardcore suspects and fewer than a dozen are believed to have had a role in attacks or plots against the US.
Mr Obama's legal advisers say the worst cases may be sent before a new court, which will handle the most sensitive national security cases.
His outline plan has the backing of many legal scholars but Republicans will strongly oppose bringing terrorism suspects to the US. Many Democrats oppose the creation of a new court system on US soil that will have fewer rights for suspects than at present.
Laurence Tribe, a Harvard law professor who is acting as a legal adviser to the Obama team, said at the weekend that "theoretical" plans for Guantanamo would now become more focused because closing the prison is a top priority. But he also predicted that transferring suspected terrorists to US soil will be a cause of controversy.
"I think the answer is going to be, they can be as securely guarded on US soil as anywhere else," Mr Tribe said. "We can't put people in a dungeon forever without processing whether they deserve to be there."
Mr Obama has already indicated that existing civilian and military court-martial systems provide "a framework for dealing with the terrorists" and the incoming administration is expected to consider those before setting up a completely new legal system.
"It would have to be some sort of hybrid that involves military commissions that actually administer justice rather than just serve as kangaroo courts," Mr Tribe said
Lawyers representing clients at Guantanamo Bay such as Marc Falkoff point out that only a dozen or so detainees are know to be avowed terrorists and say that it would be wrong to set up an entirely new legal system to deal with suspects. Mr Falkoff described the proposals from the Obama team as "a solution in search of a problem".
"Most of the detainees are goat herders, or Arabs who volunteered to help the Taliban, but they are not hardcore terrorists. The real problem is getting their home countries to accept them back."