He committed to withdrawing fighting troops from Iraq before experiencing the so-called progress on the ground and regardless of whether the US is winning or not.
That is smart. His opponent, John McCain, wants US troops to stay in Iraq either way.
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.
Rather he must confide in the American people about what needs to be done in Afghanistan in the same manner that he addressed the issue of the war in Iraq - candidly, pragmatically and strategically, away from populism, sensationalism or warmongering.
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.
Obama's support for the conclusions of the Iraq Study Group that underline regional diplomacy and political reconciliation are applicable in Afghanistan and should be the fulcrum of America's policies forward instead of more of the same war.
In his cornerstone foreign policy speech a couple of weeks ago, Obama stressed 'sound judgement' as indispensable for leadership. It is. And it outweighs McCain's experience that leads to poor political judgements.