The militants had gathered to learn techniques for making bombs and IEDS from the six foreigners, who were reportedly considered experts in the subject.
Violence in Afghanistan has been relentless while peace talks between the Taliban and government representatives that have been under way in Qatar for months have now stalled.
There has also been a nationwide spike in bombings, targeted killings and violence on the battlefield.
The Islamic State group's local affiliate has claimed responsibility for some of the attacks, but many go unclaimed, with the government putting the blame on the Taliban. The insurgents have denied responsibility for most of the attacks.
In eastern Ghazni province, the provincial governor's spokesman, Wahidullah Jumazada, said an airstrike called in during fighting with the Taliban killed at least 22 insurgents, including foreign fighters in the group.
Taliban spokesman Zabihullah Mujahid immediately tweeted a denial, saying Afghan government forces were defeated in the fighting in Ghazni. He also claimed the Taliban have no foreign fighters in their ranks.
- Additional reporting, Associated Press