Despite his relentless efforts to curb the Afghan insurgency, Obama never actually got a grip on the situation. Experts say he's leaving behind a huge mess in Afghanistan that won't be easy for his successor to clean up.
The outgoing US president, Barack Obama, is leaving behind a mixed legacy in Afghanistan. In 2009, during his first term in office, Obama ordered a drastic increase in the number of US troops in Afghanistan to tackle the Taliban insurgency.
After coming to power in 2008, Obama reviewed Washington's war strategy in Afghanistan and concluded that the US troops in the country - around 68,000 at the time - were well below the strength that was needed to quell the Afghan insurgency. Thus, he ordered a surge and deployed an additional 33,000 US troops to Afghanistan in the hope to restrain Taliban militants and train the Afghan security forces.
But he later decided to prematurely reduce a significant number of US soldiers from the war-torn nation that led to a spike in terrorist attacks in the country.
The two decisions and their consequences have pretty much determined Obama's Afghanistan legacy, say experts.
Michael Kugelman, an Afghanistan expert at the Washington-based Woodrow Wilson Center for Scholars, is of the view that by beefing up the presence of US forces in Afghanistan Obama actually took ownership of the war that was being greatly neglected when he took office.
"The surge of troops he announced went a long way toward bringing a modicum of stability, at least for a brief period," Kugelman told DW.
But then agreeing to the withdrawal of troops in 2014 - all but 8,000 troops - the outgoing president not only endangered the achievements of the surge but also the whole purpose of the US invasion of Afghanistan.
The decision had a negative impact on Afghanistan's security because the targets the US and its NATO allies had set for themselves were hugely compromised. The US was nowhere close to winning the war against Islamists, the Afghan security forces were inadequately trained to fight the insurgents on their own, and the Taliban became stronger than ever.
"Obama's hasty exit strategy along a set timeline had a negative impact on the dynamics of conflict in Afghanistan," Timor Sharan, a senior analyst at the International Crisis Group, told DW.
The drawdown, he added, left the Afghan security forces vulnerable to defending the country against a resurgent enemy and created leadership vacuum where regional powers like Pakistan, Iran and Russia gained leverage in Afghanistan.
What contributed to the failure of President Obama's Afghan war policy, according to Sharan, was the occurrence of three simultaneous transitions in Afghanistan. In 2014, when the US was in the process of withdrawing troops from Afghanistan, the country held its controversial presidential elections in which both candidates - incumbent Afghan president Ashraf Ghani and his chief executive Abdullah Abdullah - claimed victory and almost took the country to the brink of another civil war. And then came the economic transition with the withdrawal of most NATO troops from Afghanistan which resulted in a sharp decline in cash flow and employment in the country.
"Obama's timeline did not reflect the realities on the ground," Sharan said, adding that the situation allowed the Taliban to exploit these vulnerabilities and expand their presence around the country.
Obama's drone war
The US president believed that persistent drone attacks on militants operating along the Afghanistan-Pakistan border would yield better results in curbing terrorism. But this strategy was widely criticized by human rights organizations due to the high number of civilian casualties it resulted in.
It is, however, difficult to determine whether Obama's drone war was a success or a failure because the unmanned planes eliminated many Taliban and al Qaeda leaders in Afghanistan and Pakistan, including the Taliban chief Mullah Akhtar Mohammad Mansour, who was killed in July last year.
Drone attacks, as Kugelman puts it, have proved to be effective in targeting the Pakistani Taliban leaders as well as the militants linked to the so-called "Islamic State" (IS) terror group that has made significant gains in Afghanistan in the past two years.
"IS does not have a strong profile in Afghanistan, but it does have a modest presence, and taking out key leaders is a great way to demoralize and divide the group," Kugelman underlined.
But Obama's increased use of drone attacks and operations against the Taliban were accompanied by civilian casualties in Afghanistan. That turned then Afghan President Hamid Karzai against Washington.
Karzai became increasingly critical of the US' Afghanistan policies. He refused to sign a US-Afghan security pact that allowed Washington to keep military bases in Afghanistan beyond 2015.
After Karzai's departure in 2015, Obama found a cooperative partner in Afghanistan in President Ashraf Ghani, who eventually approved the security agreement with Washington.
Failed attempts for peace
Barack Obama and his generals in Afghanistan hoped that the increase in the number of US troops would defeat the Taliban in the battlefield, which would eventually force the Islamist group to come to the negotiating table. But this never happened. The Taliban gained control over more Afghan districts and provinces after the end of the surge. In 2015, the group even succeeded in briefly capturing the city of Kunduz.
But many experts don't blame the Obama administration for the failure of the Afghan peace process. They say that Pakistan's unwillingness to cooperate and convince the Taliban to start peace negotiations with Kabul is the main reason behind it.
Islamabad continued to provide sanctuaries to the Taliban and did not use its influence on the group to help Kabul and Washington, says Kugelman.
"Obama, at the least, tried hard to help spark a reconciliation process," the analyst concluded.
Pakistan - Obama's difficult ally
Throughout his two terms, Obama urged Pakistani authorities to use their influence on the Taliban to persuade the outfit to lay down arms and enter peace talks. In October 2015, the US president hosted Pakistani Prime Minister Nawaz Sharif at the White House. The two leaders "called on Taliban leaders to enter into direct talks with Kabul and work toward a sustainable peace settlement."
Experts say that in the wake of a spike in violence in Afghanistan, Pakistan's role in assisting the Afghan government in reconciliation efforts with the Taliban is vital - a fact that Obama understood and acknowledged.
But security analysts also say that Islamabad continued to provide military and logistical support to the jihadists in Afghanistan to destabilize first Hamid Karzai's and later President Ghani's government. They say that the Taliban's recent resurgence across Afghanistan is proof that they are receiving assistance from the Pakistani military establishment.
The situation in Afghanistan became so dire that President Obama had to revise his earlier decision of withdrawing all US troops from Afghanistan before 2017. In 2015, he decided that more than 5,000 US soldiers would stay in the conflict-ravaged country to help the Afghan security forces for an indefinite period of time.
Arif Jamal, a US-based journalist and author of books on extremism in Pakistan, believes that Obama was naïve to expect that Islamabad would stop the use of jihadists as a way to increase its influence in Afghanistan. He also said that Obama did not pressure Pakistani officials enough to make them rethink and revise their Afghanistan policies.
"The carrot alone is not working. The US must use the stick by imposing military and economic sanctions on Pakistan. As long as US aid keeps flowing to Islamabad, there will be no change in policy," he asserted.
Pakistan has received more than $20 billion in civilian and military aid from the US over the past 15 years, which includes Obama's eight years in power.