The president’s top military adviser is walking a tightrope as he leads the military through a divisive and unpopular war.