BRUSSELS — NATO will keep some 12,000 troops in Afghanistan for an extra year in 2016 to prevent the country again becoming a terrorist safe haven, alliance head Jens Stoltenberg said Tuesday.

NATO's Resolute Support advice and training mission was supposed to end this year but Taliban battlefield successes, especially their recent brief capture of the northern city of Kunduz, prompted a radical re-think.

"Today, NATO allies and Resolute Support operational partners have agreed to sustain the Resolute Support presence ... during 2016," Stoltenberg said after alliance foreign ministers endorsed the decision.

"The mission ... will continue to be kept under review and, if necessary, will be adjusted to ensure its effectiveness."

Troop numbers will be "12,000 approximately," in line with current strength, he added.

US-led NATO invaded Afghanistan in 2001 shortly after the 9/11 terror attacks to oust the Taliban from Kabul. US troop numbers peaked at around 90,000.

The alliance ended combat operations at the end of 2014, leaving in place the Resolute Support mission.

Taliban militants are still mounting attacks while the Islamic State is gaining a foothold in the country.

Stoltenberg said NATO had compelling reasons to complete its mission in Afghanistan with a stable government in place able to ensure security.

"We are in Afghanistan to prevent Afghanistan becoming again a safe haven for terrorists. If Afghanistan becomes a safe haven, that will also be a threat to us," he said.

He said the 28 NATO allies were also reviewing how to provide fresh funding for the Afghan armed forces for the period 2017-20, after they put up $4 billion previously.

US President Barack Obama announced in October after the Kunduz attack that he would keep the bulk of the some 10,000 US troops in Afghanistan for another year because Afghan forces "are still not as strong as they need to be."