The warning comes as IS seeks to assert a regional influence after the loss of its self-proclaimed Middle East "caliphate", and as South Asia reels from a series of devastating attacks.

"We know some have already made their way back here and are trying to transfer the knowledge, skills and experience they learned over there," a senior US intelligence official in Kabul told AFP in a recent interview.

"If we don't continue counterterrorism pressure against (IS in Afghanistan), there will be an attack in our homeland -- and a spectacular attack -- probably within the year," added the official, who asked not to be named for security reasons.

The official did not describe the nature of any plot, but IS has been linked to or inspired several big attacks in America, including a 2016 mass shooting in Florida.

The gunman, who had sworn allegiance to IS, killed 49 people in an Orlando nightclub.

A recent UN report said IS in Afghanistan has between 2,500 and 4,000 members -- about the same number the Pentagon was citing two years ago, even though officials say thousands of jihadists have been killed.

US Senator Jack Reed, the top Democrat on the Senate Armed Services Committee, said after a recent visit to Afghanistan that IS in the Khorasan, or IS-K as the local affiliate is known, had grown in both numbers and capabilities.

In 2017, the Pentagon offered a rosy assessment that IS-K could be wiped out by the end of that year. But Resolute Support, the NATO mission in Afghanistan, underestimated the group's tenacity.

"Resolute Support realised that this was bigger than a little problem in southern Nangarhar and instead would take something more to address it," the official said, referring to IS-K's bastion in eastern Afghanistan.

The official and a team of experts arrived in Kabul over the past year to help General Scott Miller -- the four-star general in charge of US and NATO forces -- tackle IS-K.

He did not say how many former "caliphate" fighters are in Afghanistan, but argued "any number is significant".

Europeans -- including from Britain and France -- are among those who have joined IS-K, he added.

Their presence could complicate any peace deal with the Taliban, who have pledged to prevent terrorists using Afghanistan as a haven to plot foreign attacks.

"Unless or until we get the Taliban to work and address this problem as well, they will never be able to keep this land free from outwardly facing organisations," the official said.

Baghdadi is back

The US has led an unrelenting air campaign, including famously dropping the so-called Mother Of All Bombs (MOAB), the Pentagon's largest non-nuclear bomb, to smash jihadist tunnels and bunkers.

But the well-funded group has replenished its ranks with foreign fighters and local recruits looking for a decent wage.

IS-K has suffered losses in the northern Jowzjan province but maintains strongholds in Nangarhar and Kunar in the east, where they have beaten back Taliban forces and displaced thousands of locals.

Internationally, IS claimed responsibility for a string of recent attacks, including the Easter Sunday bombings that killed 253 people in churches and hotels in Sri Lanka.

On Monday, the jihadists' elusive leader Abu Bakr al-Baghdadi apparently resurfaced in a propaganda video, his first purported appearance since 2014.

IS-K conducted six high-profile attacks in Kabul in 2016, according to the US. In 2017 that number grew to 18, and last year there were 24. On April 20, IS claimed a suicide attack on a government ministry.

Some Afghan officials question whether IS always oversees such assaults, or if the Taliban and Pakistan groups such as the Al-Qaeda-affiliated Haqqani network are responsible.

"These attacks are carried out mostly by these Afghan and Pakistani groups, while the credit goes to Daesh who is ready to jump and claim it," an Afghan security official told AFP, using the Arabic name for IS.

New recruits

Disillusioned Taliban insurgents sometimes switch to IS-K over spats or for ideological reasons, viewing the Taliban as not austere enough in their interpretation of Islam.

Tech-savvy recruiters track and groom potential jihadists through social media and in Kabul's universities, where middle-class and upwardly mobile students are sometimes targeted.

They are "looking for men who ... have been taught at schools paid for by this coalition. That's a little aggravating," the official said.

Thomas Joscelyn, a senior fellow at the Foundation for Defense of Democracies and editor of its Long War Journal, said that while the US military had failed to beat IS-K, it "probably stymied their growth and disrupted their operations at times."

"But it hasn't taken them out of the game," he told AFP.