Obama also committed to increasing the number of fighting brigades in Afghanistan.
That, however, is not so smart. In fact it is stupid, not because he never set foot in the country, nor because McCain makes the same promises, but because of the way the Democratic candidate has connected the two commitments.
His logic follows that Washington needs to withdraw troops from Iraq and re-direct them to Afghanistan - the centre of the "war on terror" - where the US military is over extended.
The presumably cultured liberal Obama failed to explain why killing more Afghans rather than killings Iraqis will make Americans safer, or how adopting the Bush-McCain rhetoric on the "war on terror" will win him the presidency.
It would have sufficed to take the moral high ground on the question of the unpopular war in Iraq instead of offering a pretext to widen an unwinnable and unnecessary war in Afghanistan seven years on.
Obama's opposition to launching a pre-emptive and destructive illegal war against Iraq leading to thousands of American and hundreds of thousands of Iraqi casualties has been wise not because it was politically savvy or popular, but because it was the principled position to take.
Targeting the centre
But it is an election year and candidate Obama must move to the centre to win the presidency. Right?
Well, true, but that does not mean the American centre is militaristic. If the last half century is any guide, Democrats have generally lost elections when they played into Cold War Republican militarism.
Remember, for example, how Michael Dukakis lost his double digit lead over George Bush Sr by playing the commander-in-chief role from the cockpit of an army tank, while Bill Clinton won the 1992 elections by steering away from the war rhetoric with the slogan 'it's the economy stupid'.
It is not clear why the senator from Illinois does not bother explaining to the voters that Afghanistan is as complicated a challenge as Iraq and that sending more military hardware and troops there is hardly the answer.
He also failed to explain why in light of the continuing deterioration and escalation of the war, he does not focus diplomatic energies on overcoming regional challenges for arriving at stability and peace.
Obama should have also distinguished between the Taliban of pre-2001 and the Taliban today and between the latter and al-Qaeda.
An important aspect he should have considered is that the Taliban, disagreeable as they may be, do not constitute a threat to the US as al-Qaeda does … unless Afghanistan is under foreign occupation.
And while a tougher military crackdown will likely not stabilise the country for long, alienating (or for that matter appeasing) Pakistan will also not de-escalate the violence in Afghanistan.
In fact, without Pakistan, it is impossible to neutralise the Taliban or deal seriously with al-Qaeda Central on the border between the two countries.
Meanwhile, the Afghan government is bridled with corruption, ineptness and mismanagement.
Afghanistan has also been listed as one of the worst ten countries in the world in terms of living standards with drug traffickers, criminals and warlords running amok outside Kabul.
Candidate Obama needs to approach Iraq and Afghanistan with the same sane and cool-headed strategy of constructive diplomatic and regional engagement paralleled with military disengagement.
When he returns to Washington, Obama need not boast about how a few days in the region made him a fit commander-in-chief.
Ah, well, guess there's just no pleasing some people.