Peter Bergen is CNN's national security analyst, a vice president at New America, and a professor of practice at Arizona State University. He is writing a book about the Trump administration's national security decision-making.

(CNN) One year ago, President Donald Trump announced what he said was his new strategy for the Afghan war.

He said he had become convinced that the only thing worse than staying in Afghanistan was pulling out.

In a rare admission that he had changed his mind, Trump said : "My original instinct was to pull out, and historically, I like following my instincts. But all my life I've heard that decisions are much different when you sit behind the desk in the Oval Office."

Trump said he was making an indefinite commitment to remain in Afghanistan, and would not replicate what he said was the Obama administration's mistake in prematurely pulling out of Iraq at the end of 2011, which helped create a vacuum that led to the rise of ISIS.

Trump also said he would not do what Obama had done in announcing withdrawal dates even as he surged troops into Afghanistan. "Conditions on the ground, not arbitrary timetables, will guide our strategy from now on," Trump said.

JUST WATCHED Are U.S. troops caught in never-ending Afghanistan war? Replay More Videos ... MUST WATCH Are U.S. troops caught in never-ending Afghanistan war? 04:09

This was the right call, but now the Afghan war is truly Trump's war. It is not going well.

The US Special Investigator General for Afghanistan Reconstruction found that in early 2018 the Afghan government controlled more than half of the districts in the country, while the Taliban controlled around 15%.

The remaining third of Afghanistan was contested between government forces and the Taliban.

After 17 years of war, the fact that the Taliban controls or contests almost half of the districts in the country is sobering. This month the Taliban launched a large-scale attack on the strategically important city of Ghazni and held it for five days. Ghazni sits on the Kabul-to-Kandahar road, the most important highway in the country.

ISIS has also established itself in Afghanistan, and now routinely attacks the Shia minority, like the attack on a Shia educational facility in Kabul that killed 34 students on Wednesday.

A year ago Trump promised a tougher line against Pakistan, Afghanistan's neighbor, which has long supported elements of the Taliban. He said, "No partnership can survive a country's harboring of militants and terrorists who target US service members and officials."

According to Shamila Chaudhary, a fellow at the think tank New America who worked as director for Pakistan on the National Security Council during the Obama administration, "The primary action Trump has taken in his effort to get tougher on Pakistan was to cut most US security assistance to Pakistan earlier this year. That being said, the levels of security assistance were going down anyway since the Obama administration."

JUST WATCHED Fareed's Take: Trump's way out of Afghanistan Replay More Videos ... MUST WATCH Fareed's Take: Trump's way out of Afghanistan 03:57

So far there hasn't been much evidence that the US is really going to get tough on Pakistan, which would involve sanctioning specific Pakistani officials or even designating it as a state sponsor of terrorism.

The reason is pretty simple: Afghanistan is a landlocked country surrounded by countries that are not well-disposed to the US such as Iran, and some former Soviet republics that remain aligned with Russia, and China.

That leaves only Pakistan as a somewhat reliable ally, which means that resupplying the 15,000 American soldiers in Afghanistan requires Pakistani roads and airspace. If the American presence remains substantial in Afghanistan, Pakistan will always be a necessary partner. Michael Kugelman, a Pakistan expert at the Wilson Center, observes, "The main U.S. fear has been that Pakistan could shut down the NATO supply routes on its soil."

The United States has sent some of its most capable military leaders to oversee the Afghan war , such as the generals Stanley McChrystal and David Petraeus. The commander of Joint Special Operation Command who oversees US commando operations, Lt. General Austin "Scott" Miller, just took the helm in Afghanistan, replacing the equally capable John "Mick" Nicholson, who has arguably spent more time in Afghanistasn than any other US military officer.

The Afghan war is unlikely to be won on the battlefield. The Taliban haven't been defeated in 17 years despite enormous pressure, including Obama's "surge" of troops into Afghanistan during his first term. There were around 100,000 US troops in the country in the early years of Obama first term and they didn't defeat the Taliban. Today, there are some 15,000 troops.

JUST WATCHED US troops in Afghanistan: A history (2017) Replay More Videos ... MUST WATCH US troops in Afghanistan: A history (2017) 01:27

As of July, the Trump administration is reportedly talking to the Taliban directly, seemingly because there is an understanding that decisive battlefield success will continue to be elusive. These talks happened without Afghan government representation, which has long been a Taliban demand: To speak directly with the American government.

There is little to lose by such talks; even if they yield nothing they allow the US to gather intelligence on the Taliban and perhaps even create splits in the movement between potential doves and hawks.

That said, expectations for these talks should be low; the Taliban are hardly going to put down their arms when they are doing relatively well on the battlefield, nor have they articulated a concrete vision of what they really want for Afghanistan, beyond the expulsion of foreign troops.

Which brings us to politics. In 2019 there will be another Afghan presidential election. The past two such elections were fiascos with innumerable, credible accounts of fraud by all sides. This must not happen again, as a badly flawed presidential election damages the credibility of all Afghan institutions.

The Trump administration should be clear with all the key political players in Afghanistan that it will not tolerate another botched presidential election and such a result might end any American support to Afghanistan.

Follow CNN Opinion Join us on Twitter and Facebook

At the same time the US government and its NATO allies in Afghanistan must invest enormous effort in ensuring that the elections are free enough and fair enough to ensure a credible Afghan government emerges in 2019.

Without that, everything else that the US does in Afghanistan is mostly a waste of time.

Update: This article has been updated in light of news developments.