Although there are thousands of detainees being released there are still over 20 thousand in U.S. detention. The U.S. can arrest people at will:
The U.S. military says its detention system is authorized by a U.N. resolution under which the Iraqi government allows U.S. troops to arrest people at will. U.S. military attorneys say it also complies with international laws covering warfare and was created in "the spirit" of the Geneva Conventions.
Commanders say they are entitled to hold any prisoner until the detainee is no longer considered a threat to U.S. forces. Local law and court rulings do not apply, they add.
Rights groups have criticized U.S. detention policy as a misrepresentation of international law, which they say requires some form of legal process to detain someone.
The right of the U.S. to detain Iraqi citizens has been one of the contentious areas of debate with the Iraqis over a new security agreement that would keep U.S. forces in the country after a U.N. mandate expires at year's end.
So after in effect legalizing an occupation and invasion that was against international law the UN then provides cover for the occupiers and allows them to detain people in ways that many think are also violations of international law. Of course the same thing happened in Afghanistan. The NATO and ISAF and U.S. operate under UN resolutions passed after the occupation which was never itself authorised and was also a violation of international law. Of course some claim that the action was self defence although the Taliban certainly never threatened the U.S. in an direct way. In fact Colin Powell had not long before the invasion given the Taliban a check for among other things their work in stopping opium production. Maybe they are waiting for the next check!