U.S. military authorities have said a U.N. Security Council mandate allows them to retain custody of a detainee they believe is a security risk even if an Iraqi judicial body has ordered that prisoner freed .