But the US military has been releasing prisoners or handing them to Iraqi control since January as part of an agreement with the Baghdad authorities , and ahead of a US pullout from the country in 2011 .