(CNN) -

The current chaos in Iraq is tragic in almost every way. In retrospect, it is easy to conclude Iraq was not nearly ready enough to assume control of its own security situation when the United States made the decision to withdraw forces in December 2011. The wisdom of that decision will long be debated, but having made it, the United States is now understandably reluctant to undo it.

Even as the Obama administration sorts through a galaxy of unattractive options, none of which is guaranteed to provide stability, it would be well-advised not to overlook one of the biggest strategic lessons of the Iraqi deterioration. That would be the warning signal it provides for another country headed down the same disturbing path: Afghanistan.

While Iraq and Afghanistan are of course vastly different in terms of demographics, history and terrain, the parallels emerging between them in terms of security implications and political process are too important to ignore.

An extremist militant group rising quickly and taking over large swaths of the country. A government focusing more on retribution and vengeance than reconciliation and governance. And a supposedly well-trained army essentially disintegrating in the face of real conflict. All of these characteristics describe the situation in Iraq, but all may be equally descriptive of Afghanistan in only a few short years.

Similar to Iraq, Afghanistan has an ethnic, well-organized and well-funded insurgent group poised to retake significant amounts of territory once U.S. troops leave.

There can be no doubt that the Taliban, having seized power once before in Kabul, is only biding its time until it can do so again. Much like the Islamic State in Iraq and Syria, the Taliban takes advantage of the limits of federal influence and governs by fear and aggression. It is only a matter of time before the Taliban, newly emboldened by the recent prisoner swap that freed five militants, takes control of southern Afghanistan and challenges Kabul's authority.

Compounding this situation is the shaky and corrupted political process under way, which makes Iraq look like a well-functioning democracy. In a variation of Iraqi Prime Minister Nouri al-Maliki's sectarian tendencies, outgoing Afghan President Hamid Karzai has done little to unite Afghanistan's many tribal factions during his 12 years in office, instead often fomenting discontent.

While both of the leading presidential candidates have pledged to focus on unity, there is little reason to believe that either will make it a priority. Ominously, one candidate has already boycotted the electoral process before the results of the June 14 run-off election even being announced. As a result, Afghanistan could become even more politically divided than Iraq is today.

Perhaps the biggest wild card in Afghanistan's future is the Afghan National Army. Much like the Iraqi army, the Afghan army will be charged with maintaining the security situation once the United States departs. And much like the Iraqis, the Afghans have been trained by the United States. As we heard in Iraq, the training of the Afghans will be sufficient preparation to defend the country from any threats that may arise.

While the Afghans may be courageous soldiers, there have been numerous reports of lackluster performances. So much so that their abilities in actual combat situations remain uncertain. In addition, Afghanistan has never had a real national fighting force, meaning there are few examples and fewer role models for current soldiers to emulate.

As a national army, the Afghans came from a much less mature and much less professional starting point than the Iraqis. As illustrated in Iraq, without the right training and leadership, soldiers may not be willing to defend against insurgents, despite an enormous numerical advantage.

Given all this, it is not difficult to look at the situation in Iraq and see Afghanistan's future. Indeed, with a resurgent Taliban, political instability in Kabul, an untested army and if the United States continues with its plan to drawdown forces at the end of 2014, especially without an agreement in place for the retention of American security personnel, a future similar to Iraq's may be inevitable.

However, unlike Iraq, this bleak Afghan future need not necessarily become reality. The United States still has an opportunity to avoid making the same mistakes it made in Iraq.

To accomplish this, the United States needs to redouble its efforts at training the Afghan army to develop it into a legitimate fighting force. It needs to put diplomatic pressure on the new president as soon as he takes office to embark on a unification and reconciliation process. And most important, it needs to plan for a withdrawal based on appropriate benchmarks and conditions, not on a political timetable.

Such a change in strategy would undoubtedly be domestically unpopular. But sometimes, unpopularity is a necessary price for avoiding a far worse alternative in the future.