Gen. John W. Nicholson, center, listens to a speech during a ceremony marking the change of command in Kabul. Lt. Gen. Austin Scott Miller, right, is the incoming U.S. military commander in Afghanistan. (EPA-EFE/Shutterstock)

The outgoing U.S. military commander in Afghanistan issued an impassioned call to Taliban insurgents Sunday, asking them to “stop killing your fellow Afghans” and come to the peace table but warning them to “make no mistake: Until you are willing to start talking, we will keep fighting.”

Gen. John W. Nicholson, 61, spoke at a formal military ceremony that marked his departure after 30 months leading the advisory mission of up to 14,000 U.S. troops in a NATO coalition here, and the arrival of his replacement, Lt. Gen. Austin Scott Miller. The handover came at an uncertain time of both aggressive insurgent threats and nascent hopes for reconciliation after 17 costly years of war.

Miller, speaking after color guard troops passed him the green flag of the U.S. Resolute Support mission, echoed Nicholson’s resolve. He noted that with 41 nations in the coalition, “the world recognizes that Afghanistan can’t be a safe haven for terrorists. The world recognizes that we cannot fail.” He said the conflict is still “a tough fight” but that “what we do here will be vital to both Afghanistan and the world.”

Miller, 57, has spent much of his career overseeing Special Operations forces, and his most recent position was as commander of the Joint Special Operations Command. He was among the first U.S. soldiers to enter Afghanistan after Sept. 11, 2001, and since 2013 he has commanded various Special Operations units in which U.S. and Afghan forces work together in counterterrorism teams fighting the Islamic State and other groups.

The change of command is traditionally a time of reflection and scrutiny for the U.S. military role here. Miller is arriving at a moment of fresh questions in Washington about the role and duration of the U.S. military commitment, confusion about the intentions of the Taliban, and growing doubts about the Afghan government’s leadership and internal cohesiveness, in relation to both security policies and political dealings.

The outdoor ceremony at the Resolute Support headquarters came at an especially difficult moment for President Ashraf Ghani, who worked closely with Nicholson but did not attend the event. Ghani’s offer of an extended cease-fire last month was rebuffed by the Taliban, which had just staged a deadly four-day assault on a large Afghan city. Just over a week ago, his national security adviser, Hanif Atmar, abruptly quit, citing policy differences but sparking rumors of a wider political split among Ghani’s aides.

Nicholson, in his farewell remarks, noted that both political and military challenges face the country, especially with two elections scheduled in the next eight months. Accusations of political pressure and bribery have been roiling the pre-election process and vetting of candidates. Nicholson asked Afghans to “please not allow politics to undermine the political process; please do not allow politics or ethnicity to harm the cohesion of the Afghan security forces.” 

The transition ceremony, which was attended by about 200 Afghan officials and foreign guests, seemed partly designed to allay such fears. The only Afghan speaker was Hamdullah Mohib, 35, who was Afghan ambassador to Washington until late last month, when the president named him to replace Atmar as his top security aide. The appointment was widely criticized due to Mohib’s youth and lack of experience. 

Mohib, wearing a dark suit and dark glasses, spoke confidently and eloquently, however. He praised the service of Atmar, 50, who was sitting in the audience, saying, “Yours are difficult shoes to fill.” He also asked Atmar directly for his support to show “continuation,”“not just on the American side but on ours as well.” 

Turning to Afghanistan’s foreign allies, Mohib said he represented “a new generation that is your partner in change” — a generation that he said wants to build a country based on “institutions” instead of ethnic, tribal and military loyalties. “General Miller,” he declared, “we stand with you shoulder to shoulder” in the fight against insurgency and terrorism. “We have a bloody nose, but we are not defeated.”

While both Nicholson and Miller stressed the challenges still facing U.S. and Afghan forces, a slightly more upbeat assessment at the ceremony came from their boss, Gen. Joseph L. Votel, who heads the U.S. Central Command. Instead of focusing on the recent Taliban truce snub, he reminded the audience that in June, Taliban fighters and Afghan troops and civilians had celebrated together during an unprecedented three-day cease-fire, generating nationwide hopes for reconciliation.

“The cease-fire was short, but it demonstrated to the world that not only the Afghan people are ready for peace, but their adversaries are as well. There is much fighting and talking left to do,” Votel said, “but we are up for it.”

Votel also praised Nicholson as the “premier warrior-diplomat,” saying that under his command, the U.S. advisory and assistance mission helped expand the Afghan Special Operations forces and air force, reorganize security ministries, and bring all six national army corps into the battle against insurgents. Despite continued Taliban aggression, he advised Miller, “this is the right time to build on that momentum.” 

Correction: An earlier version of this story misstated the number of months that Gen. John W. Nicholson served as U.S. military commander in Afghanistan. He led the advisory mission for 30 months. This story has been corrected.