U.S. Army Gen. Austin Scott Miller assumed command of the 41-nation NATO mission in Afghanistan in a handover ceremony on Sunday.

Miller took over from Gen. John Nicholson, who held the post for more than two years, at a ceremony at NATO headquarters in Kabul attended by senior Afghan officials and foreign ambassadors.

The handover comes as Afghan forces are struggling to contain a resurgent Taliban and an increasingly powerful Islamic State affiliate. The Taliban control several districts across Afghanistan, and both groups have launched a relentless wave of attacks in recent months.

"The world recognizes Afghanistan cannot be a safe haven for terrorism, the world recognizes that we cannot fail. I know this has been a long fight, and it has been generations for us, for the Afghan people," said Miller, who most recently led the Joint Special Operations Command.

Nicholson called on the Taliban to accept the government's offer of a cease-fire and renewed peace negotiations, saying "you don't need to keep killing your fellow Afghans."

The nearly 17-year-old NATO mission began with the U.S.-led invasion that toppled the Taliban after the Sept. 11 attacks. The U.S. and NATO formally ended their combat mission in 2014 but still routinely come to the aid of Afghan forces.

Afghanistan's national security adviser, Hamdullah Mohib, acknowledged the setbacks, saying "we have a bloody nose, but we are not defeated."

Also Sunday, at least four people were wounded after their vehicle was detonated by a sticky bomb in the capital Kabul, according to Nasrat Rahimi, deputy spokesman for the Interior Ministry.

Rahimi said the blast took place near the capital's diplomatic area. "All four wounded people were transferred to hospital and they are not in a life-threatening condition," he said.

No one immediately claimed responsibility for the attack in Kabul, but both Taliban insurgents and Islamic states militants are active and have claimed earlier attacks in Kabul.