He has signaled a willingness to distance himself from a trusted and beleaguered ally—to Iran’s advantage.