U.S. generals have warned that the hard-won gains of the past 18 months could be lost by a precipitous withdrawal.