A U.S. military court in Afghanistan has sentenced an American soldier to six months confinement and a reduction in rank after finding him guilty of mistreating Afghan detainees .