KABUL, Afghanistan - American and NATO troops closed their operational command in Afghanistan on Monday, lowering flags in a ceremony to mark the formal end of their combat mission in a country still mired in war 13 years after the U.S.-led invasion toppled the Taliban regime for harboring those responsible for 9/11.

The closing of the command, which oversaw the day-to-day operations of coalition combat forces, is one of the final steps in a transition to a support and training role that begins Jan. 1. But with President Obama's recent move authorizing U.S. forces in Afghanistan to carry out military operations against Taliban and al-Qaeda targets, America's longest war will in fact continue for at least another two years.

Obama's decision to give American forces a more active role than previously envisioned suggests the United States is still concerned about the Afghan government's ability to fight. And agreements signed by Afghan President Ashraf Ghani to allow U.S. and NATO troops to remain in the country are seen as a red line by the Taliban, further narrowing any hope of peace talks.

Not only are the Taliban a resilient insurgency, a new generation of extremists inspired by Osama bin Laden threatens the entire region. American forces are now also involved in a burgeoning military campaign against Islamic State militants in Syria and Iraq, where Obama had hoped to end combat operations three years ago.

As NATO's International Security Assistance Force's Joint Command lowered its flag in the capital, the Taliban carried out yet another bloody attack, this time killing a police officer and four civilians at a police station in southern Afghanistan.

Taliban spokesman Zabihullah Mujahid told the Associated Press the group would continue to fight "until all foreign troops have left Afghanistan."

"The Americans want to extend their mission in Afghanistan, the motive being to keep the war going for as long as possible," Mujahid said. "And for as long as they do, the Taliban will continue their fight against the foreign and [Afghan] government forces."

From Jan. 1, the coalition will maintain a force of 13,000 troops in Afghanistan, down from a peak of about 140,000 in 2011. As of Dec. 1, there were about 13,300 NATO troops in the country.

Up to 10,800 U.S. troops will remain in Afghanistan for the first three months of next year, 1,000 more than previously planned, said a NATO official who spoke on condition of anonymity to discuss troop deployments. By the end of 2015, however, American officials say the U.S. troop total will shrink to 5,500, and to near zero by the end of 2016.

Obama's recent decision broadened what had long been billed as an "advise and assist" mission set to begin next year, allowing American forces to launch operations against the militants as well as to provide combat and air support. Afghan officials have also said that Ghani is considering a resumption of night raids that could involve Americans.

Nevertheless, U.S. Gen. John F. Campbell, commander of NATO and U.S. forces, said foreign troops will now focus on training and supporting Afghan soldiers and police, who have led the fight against the Taliban insurgents since mid-2013.

"The Afghan security forces are capable," Campbell said. "They have to make some changes in the leadership, which they're doing, and they have to hold people accountable."

Ghani, who replaced President Hamid Karzai, is overhauling Afghanistan's military and the security apparatus. He has begun replacing provincial governors in volatile areas, and his office said military leaders will also be replaced. His National Security Council is working on a manual that will establish rules of engagement and battlefield practices for Afghan security forces.