John R. Allen is commander of the NATO International Security Assistance Force and U.S. forces in Afghanistan.

We can achieve what we set out to do in Afghanistan, defeating al-Qaeda and denying it a haven, but that depends on achieving an Afghanistan that can stand on its own.

I recently attended a celebration here to commemorate Afghanistan’s 93rd year of independence. I was struck by the hope and the strengthening of the Afghans’ national identity and their determination to grip their country’s future. Most Americans do not get to see Afghans’ commitment to their country or the improving security that has emerged from our fight together. But I do. And I am confident that, with the international community’s commitment, we can consolidate our gains and build a durable peace in a part of the world vital to U.S. national security.

This moment in Afghan history has arrived not by accident or luck but in the wake of powerful events: the growing strength and capability of Afghan security forces; the signing of bilateral and multilateral strategic partnerships; and the international community’s pledge of substantial support for the next decade.

These accomplishments have been borne on the backs of remarkable allied and Afghan forces — those serving today and those who have gone before. Their tremendous sacrifices are creating security conditions that, finally, are bringing a real sense of confidence to the Afghan people.

We will not allow our efforts to be derailed by the so-called “green-on-blue” attacks — Afghans shooting coalition troops — that have received so much attention recently. Each instance is a tragedy, and we mourn every loss. I have stood on the ramps of airfields here as we’ve sent home our fallen heroes. I take personally the loss of every member of the International Security Assistance Force. Afghan and international leaders at all levels are devoting unprecedented time and effort to reduce this threat. We have implemented measures to better protect our troops; we have helped build an Afghan force of close to 350,000; and Afghans are leading security operations in three-quarters of the country. This momentum is irreversible.

But the real story here is green andblue. Every day, hundreds of thousands of Afghan soldiers and police across this nation work and fight side by side with coalition troops to defeat our common enemies and protect the civilian population. We interact closely on numerous operations, extending security for the Afghan people.

The focus on “green-on-blue” attacks obscures the callous slaughter of Afghan civilians by insurgents led by Mohammad Omar. He has the blood of innocents on his hands even though he hypocritically tells his subordinates not to attack civilians. Either he is out of touch, or his forces are out of control. Perhaps that should be no surprise. Omar lives in Pakistan, as do many of his “commanders.” From that safe vantage point, they’ve sent hundreds of young, impressionable, largely spiritual and helpless youths to their deaths and detention in Afghanistan. For this, they must forfeit their honor and any claim to Islamic virtue.

And they are losing. “Green” and “blue” have been taking the fight to the red enemy, the Taliban, and the enemy is fighting back from a position of weakness. His forces have largely been ejected from most of the relevant population areas, and from among the most relevant terrain in Afghanistan, the Afghan people. Omar is losing financial support from donors, who are sending their money elsewhere, and from reduced drug profits, thanks to Afghan and coalition efforts to stamp out the poppy harvest. Finally, Afghan security forces are increasing in number and quality every day. The area controlled by allied and Afghan forces reaches into Taliban support zones that had long been inaccessible. With each atrocity, assassination and depredation inflicted on innocent Afghans, the insurgents further distance themselves from the Afghan people and their faith, for there is a distinctive Islamic prohibition against murdering innocent civilians or benefiting from the scourge of drugs and abject criminality.

This is playing out in another important color combination: white on red. The Afghan population is organizing to drive the hated Taliban from their villages. This movement is emerging in areas where the heavy hand of the Taliban has created a popular groundswell against the insurgents.

These trends speak well for the future of Afghanistan, but the international community should know these gains are fragile, and reversible, if we lose our will to succeed.

U.S., allied and Afghan security forces will continue to deal with “green-on-blue” attacks. We will mourn our precious dead, but we will not permit this threat to derail the progress being made by coalition and Afghan forces. We also resolve to protect the civilian population, the “white,” from the scourge of the Taliban, the “red.”

This struggle is far from over, but the solution will be found in our growing strength and will not be defined by incidents of “green-on-blue” violence. Our cause is right, our determination is clear and our sacrifices have not been in vain. We are, in fact, prevailing.