The military failure abroad has created a political dilemma at home.