There are essentially three types of detainees in Gitmo.
One type is the innocent farmer who was rounded up for no particular reason except he was in an area where fighting occured, and where captured along with the enemy fighters. Those guys can be let go, except there’s no particular way to tell the difference between a farmer with a gun who wasn’t fighting against the US and a farmer with a gun who was. Lots of people in Afghanistan carry guns, so how do you tell the difference between fighters and farmers when the fighters are just farmers who shoot back?
The second type would be equivalent to POWs. They fought against US forces. This is not a crime, however, under the Geneva conventions enemy soldiers can be detained indefinately as long as fighting continues. As long as we’re still fighting guerillas in Afghanistan those people can be detained without trial indefinately. They haven’t commited a crime, it isn’t a crime to fight against US forces as long as they do so openly as members of a militia. Enemy POWs aren’t criminals, so they don’t have to be charged. However, extrajudicial killing of enemy soldiers is perfectly legal, you can shoot enemy soldiers even if they are asleep. But if you capture them you aren’t entitled to convict them of crimes. And the whole point of this provision is to enable soldiers to surrender without fear they will be executed by the enemy. Allowing the enemy to surrender without fearing summary execution is good for the capturing army, since it makes winning easier if the enemy surrenders without fighting to the death.
The third type would be criminals. You aren’t given a pass to murder someone just because your murder victim is a US soldier. You have to do so as a member of a militia…otherwise you’re just a bandit and a killer and a criminal. A guy in Afghanistan has no more right to fire a rifle at US soldiers than you or I do. It doesn’t matter if those US soldiers invaded your country, you can’t grab a rifle and shoot them any more than a random US citizen can shoot illegal immigrants crossing the US-Mexican border.
But the truth is that in a pre-state region like Afghanistan there isn’t much difference between an armed farmer who isn’t shooting at you…today, an armed farmer who shot at you but did so as an enemy soldier entitled to protection by the geneva convention, and an armed farmer who illegally tried to murder a US soldier. Most of the people at Gitmo are simply people who fought against the US as members of the Taliban or some other militia, and could thus be considered enemy soldiers. However, if their militia still exists and is still fighting against the US, they are still legitimate POWs and can therefore be held indefinately. Even if they never actually fired a weapon in anger, if they were a member of a militia fighting against the US they are POWs and until the war is over they can be held perfectly legally, and perfectly morally.