Pakistan is still a major destination for radicalised Muslims bent on a life of jihad, despite hundreds of US drone strikes, the death of Osama bin Laden and the fracturing of al qaeda.
New battlegrounds have sprung up in Africa and the Middle East, but the number of foreign recruits smuggled into the northwestern tribal belt is increasing and they come from more diverse countries.
Since the 1980s "jihad" to expel Soviet troops from Afghanistan, Muslim fighters from all over the world have lived and trained on the Afghan-Pakistan border, moulded into al qaeda and a host of spin-off militant networks.
After US-led forces in late 2001 evicted the Taliban in Kabul for sheltering al Qaeda, Afghan Taliban fled across the border into Pakistan.
But Washington and Nato will end their combat mission in Afghanistan next year and these days the Taliban say their foreign allies are drawn to other conflicts, despite their support networks in a region outside direct government control.
"Al Qaeda is shifting its focus to Syria, Libya, Iraq or Mali," one member of the Afghan Taliban said on condition of anonymity in northwest Pakistan.
Local officials estimate the number of Arab fighters has fallen by more than a half or two thirds in the last 10 years, to below 1,000.
In the last two years, some al qaeda Arabs, particularly Libyans and Syrians, left to take part in the civil war in Syria and the violent uprising that overthrew Libya's dictator Moamer Khadhafi in 2011.
Others migrated to Iraq in 2003, and others to Somalia and Yemen.
But Saifullah Khan Mehsud, executive director of the FATA Research Center, a think-tank focused on the tribal belt, says uprisings in the Middle East have had a minimal effect on the Arab presence in Pakistan.
"Arab fighters are not leaving in big numbers," he said.
"They have been there for 30 years and it continues," he added.
The number of fighters from other countries is also rising, say witnesses in Miranshah, the main town of North Waziristan -- the district with the largest concentration of Taliban and al Qaeda fighters.
"The overall number of foreign jihadis has increased in the last two years. Every week we see new faces," says one regular visitor.
There could be around 2,000 to 3,500 foreign fighters in the border areas from around 30 different countries. During the 1980s, the number was also estimated to have been several thousand.
More nationalities, same problems
Most of the current crop are Turkmens and Uzbeks, numbering between 1,000 and 3,000 fighters according to local officials, who have fled authoritarian secular regimes in their home countries to set up their own groups.
The Islamic Jihad Union, which splintered from the Islamic Movement of Uzbekistan, is based in Pakistan's border areas.
It is committed to toppling the government in Uzbekistan, and fights alongside insurgents in Afghanistan. It has also plotted an attack in Germany, which was foiled.
US officials say covert drone strikes have played a huge role in destroying training camps and disrupting al qaeda in Pakistan.
According to the London-based Bureau of Investigative Journalism, 362 US drone strikes have been reported in Pakistan since 2004 -- 310 of them since US President Barack Obama took office in 2009.
Although North Waziristan locals say the strikes kill more Taliban than al qaeda operatives, they have condemned foreign fighters to a life underground.
"They are low profile, they dress like locals, they avoid big meetings and above all they move all the time," a local journalist said.
Mehsud says that foreigners are coming from a more diverse number of countries than in years past.
"A few months ago, we even welcomed some (two or three) people from Fiji for the first time!" says the Taliban member.
"There are more nationalities because they face the same problems. They tell us that they feel left aside by capitalism and discriminated by unfair laws, like the Swiss one on minarets or the French one on hijabs," he adds.
Local and Western officials say the number of Western militants have fallen to dozens compared to the several hundreds of a few years ago.
A Canadian, who uses the name Mohammad Ibrahim, said that he had been in Pakistan for three years but was now preparing to leave to wage jihad at home.
"Foreigners are now afraid to come to Pakistan because of the drone strikes," he says, putting the number of his compatriots at 14, compared to "60 to 85 three years ago".
A mechanical engineer by training, he says he works in "technical and logistic affairs" but does not elaborate further.
"I often met British, Spanish, Italians, Algerians and Germans. But now... our movements have been limited because of the drone strikes," he says.