Barack Obama, who vowed in the campaign to “end the war” in Iraq, is making clear that tens of thousands of troops will stay there.