With each successful Taliban attack, the inevitable headlines appear about America’s failures in Afghanistan.

That’s why, as President Donald Trump reviews his Afghan policy this summer, it is important that he does not start seeing every tactical victory of the Taliban as America’s strategic defeat.

Overall, good progress has been made in Afghanistan, and Trump should remain committed to the strategy he outlined last year.

After the 9/11 attacks, there were two main goals in Afghanistan: First, to deny al-Qaeda a safe haven from which to plan, train, and launch terrorist attacks on a global scale, and second, to remove the Taliban regime from power as punishment for not cooperating with the international community and for harboring terrorism.

Both were accomplished with relative speed.

As the years went by, the U.S. military presence in Afghanistan was defined around the quixotic goals of creating “a strong central government” and a “pluralistic society.”

We have tried accomplishing these goals by “holding free and fair” elections, “tackling corruption,” and building the “institutions of democracy.”

That created an impossible situation for the U.S. military. With the lofty goals of nation-building defining our success in the early days, the only thing most people see today in Afghanistan is failure.

Far from having failed in Afghanistan, the U.S. and its allies have delivered considerable progress in Afghanistan.

After the successful targeting of Taliban leaders, combined with a robust counterinsurgency campaign over the years, the Taliban as a national movement has degenerated into several smaller, weaker, and localized insurgencies—each with a different set of grievances and goals.

Even with the recent horrific attacks in Kabul, the level of violence in Afghanistan is nowhere close to its peak.

Al-Qaeda, which once used Afghan territory with impunity, no longer enjoys a safe haven in Afghanistan. The threat posed to Afghanistan by the Islamic State is not even close to being in the same league as the Taliban, and pales in comparison to the terrorist group’s other affiliates in Syria, Libya, and Yemen.

No major terrorist attack originating from Afghanistan has been successful in the United States since 2001.

The Taliban that rolled into Kandahar and Kabul in the mid-1990s with tanks and planes is a shadow of its former self today.

In 2001, outside of a small rump of territory run by the Northern Alliance in northeast Afghanistan, the Taliban controlled 90 percent of the entire country. Today, according to the Special Inspector General for Afghanistan Reconstruction’s most recent quarterly report to Congress, the Taliban has “control or influence” in an area equaling only 13 percent of the country’s population.

By contrast, 65 percent of Afghanistan’s population live under the “control or influence” of the Afghan government. The remaining 22 percent of the population lives in “contested” areas.

That is not bad. Al-Qaeda is essentially gone. ISIS is unable to establish a meaningful foothold in the country. The once omnipresent Taliban has been relegated to a divided and disparate insurgency.

Even so, there is a constant drumbeat of articles and commentary talking about America’s failure in Afghanistan. It is unclear what would make these critics of the Afghan war happy. Would they be happy when only 10 percent of Afghanistan’s population was under Taliban control? Five percent? None?

After almost 17 years of warfare, maybe we should come to terms with the fact that until there is a genuine political settlement between all warring parties, and until Pakistan stops providing succor to the Taliban, what we see in Afghanistan might be as good as it’s going to get.

The American public has every reason to be proud of what the U.S. military has accomplished under very challenging circumstances in Afghanistan.

It is time that we have a dose of realism of what to expect in Afghanistan and lower our expectations on what is achievable for the future. Afghanistan will not be perfect or suddenly become some Switzerland in the Hindu Kush.

Unless you are some idealistic dreamer who has never stepped foot in the country, that was never the goal.

Success will be achieved when there is a stable enough Afghanistan—that is, when it is able to manage its own internal and external security to a degree that stops interference from outside powers, allowing the country to resist the re-establishment of terrorist bases that were there before. Nothing more and nothing less.

The immediate criticism of Trump’s strategy last year was based on the argument that 4,000 more trainers will not be able to do in 2018 what more than 100,000 U.S. troops were unable to do in 2011.

But this argument stems from an old way of thinking about America’s role in Afghanistan. The war being fought in Afghanistan today is not the same war as in 2001 or even 2009 (the year President Barack Obama unveiled his Afghan strategy), when the U.S. was leading combat operations.

Today, the Afghans are in the lead, and the U.S. mission is one of training, advising, and assisting.

The Afghan security forces are that country’s ticket to long-term security and stability. If the U.S. and its allies continue to mentor, train, and fund the Afghan military, the Afghans will be able to do a better job at taking on the insurgency themselves.

Not only will that help the Afghans prevent their country from becoming a hub for transnational terrorism, but it also will eventually establish the security conditions in which a genuine political process can take place. That latter point is the most important.

In his speech last year when announcing his new strategy, Trump alluded to an eventual political settlement “after an effective military effort.” That is right. You can no more fight your way out of a insurgency campaign any more than you can drink yourself out of alcoholism.

The goal of any counterinsurgency is to allow those who have legitimate political grievances the ability to address these grievances through a political process and not through violence.

If the insurgency in Afghanistan ever ends, it will be through a political settlement between the Afghan government and the Taliban.

As Trump makes a decision later this summer about the future of the U.S. role in Afghanistan, he needs to start measuring success by achievements on the ground and not by unrealistic expectations.

The president should drown out the constant criticism of the campaign and remain committed to the realistic, reasonable, and responsible strategy he outlined last year.

Afghanistan is a complex place. There is a huge space between victory and defeat. That is where we are today—and where we will likely be for the foreseeable future.

That does not mean we have failed. That is simply reality.