U.S. Secretary of Defense Jim Mattis and NATO Secretary-General Jens Stoltenberg have pledged continued support for Afghanistan during a surprise visit to Kabul.
The two vowed at a September 27 joint conference with Afghan President Ashraf Ghani to do everything so the country "doesn't again become a safe haven for international terrorists."
Stoltenberg said NATO is aware of "the cost of staying in Afghanistan, but the cost of leaving would be even higher."
He added that "if NATO forces leave too soon, there is a risk that Afghanistan may return to a state of chaos and once again become a safe haven for international terrorism."
Stoltenberg also said the alliance was committed to funding the Afghan security forces until at least 2020. He said NATO would keep providing almost $1 billion each year to the Afghan defense and security forces.
Mattis said that "through our partnership, we will suffocate any hope that Al-Qaeda or [Islamic State],...Haqqani or the Taliban have of winning by killing," referring to militant groups operating in Afghanistan.
He added that he wanted "to reinforce to the Taliban that the only path to peace and political legitimacy for them is through a negotiated settlement."
"The sooner the Taliban recognizes they cannot win with bombs, the sooner the killing will end," Mattis said.
As Mattis was meeting with Ghani, militants fired a volley of rockets at Kabul International Airport in an attack that the Taliban said targeted the U.S. secretary of defense’s plane.
One civilian died and 11 others were wounded in the attack, the Afghan Interior Ministry said.
Afghan security forces managed to repel the attackers, killing four in an ensuing gunbattle, officials said.
Mattis called the attack "a crime."
The NATO-led Resolute Support mission later said a U.S. air strike called in to support an Afghan special forces unit battling the attackers mistakenly caused an undisclosed number of civilian casualties.
"Tragically, one of the missiles malfunctioned, causing several casualties," a statement said, without providing details.
The Afghan government is struggling to beat back insurgents in the wake of the exit of most NATO forces in 2014.
A U.S. report found earlier this year that the Taliban controls or contests about 40 percent of the country, and security forces are also fighting against militants affiliated with the extremist group Islamic State (IS).
U.S. President Donald Trump last month announced a new Afghanistan strategy he said was aimed at defeating the Taliban after nearly 16 years of war.
Defense officials say the president's new strategy will try to repeat the success of U.S. efforts over the past two years to strengthen Iraqi security forces against the IS group with better training, logistical support, and the battlefield backup of U.S. artillery and air strikes on enemy positions.
The United States is also pressing for NATO partners to increase their own troop levels in Afghanistan.