KABUL, Afghanistan — A Taliban assault that threatened to overrun a northern Afghan city involved foreign fighters, officials said Saturday, in a battle that saw at least 100,000 people flee their homes.

Kunduz’s provincial governor and its police chief said the foreign fighters could be part of a small contingent of militants who pledged their loyalty to an Islamic State affiliate in Afghanistan, but offered no evidence to support their claim.

The battle in Kunduz began April 24. Thousands of army reinforcements have been deployed to the city. Officials had feared in the days after the attack that Kunduz could fall to the Taliban.

Provincial Gov. Mohammad Omer Safi said the bodies of 18 foreigners had been retrieved from the battlefield, found to be from Tajikistan, Uzbekistan, Kyrgyzstan, Turkey and Chechnya.

Safi said the foreign fighters provided technical and financial support to the Taliban fighters who he believed were fresh graduates from madrassas in Afghanistan and neighboring Pakistan with little battlefield experience.