He has been consistently in support of the wars since 2007, but most of his supporters ignored it and hoped that he would somehow change his mind once in office.
That didn't-and obviously wouldn't-work, but now we're seeing the results of that mistake with the continued support for the war in Iraq and the escalation of the Afghanistan War.