WASHINGTON - The collapse of Islamic State's self-proclaimed caliphate has not diminished the militant group's ability to inspire attacks on Western targets via the internet, U.S. national security officials told senators on Wednesday.

The Sunni Muslim extremist group has been building its external operations over the past two years and has claimed or been linked to at least 20 attacks against Western interests since January, said Lora Shiao, acting director of intelligence at the National Counterterrorism Center.

"Unfortunately, we don't see ISIS' loss of territory translating into a corresponding reduction in its inability to inspire attacks," she told a U.S. Senate committee.

"ISIS' capacity to reach sympathizers around the world through its robust social media capability is unprecedented and gives the group access to large numbers of HVEs," Shiao said, using the government's acronym for homegrown violent extremists.

The U.S.-led coalition fighting Islamic State estimated on Tuesday that fewer than 3,000 fighters belonging to the hardline Sunni militant group remain in Iraq and Syria, where they declared a caliphate in 2014.

ISIS was driven out of Raqqa, the Syrian city it called its capital, in October, prompting President Donald Trump to say "the end of the ISIS caliphate is in sight."

Yet "the elimination of the physical caliphate does not mark the end of ISIS or other global terrorist organizations," said Mark Mitchell, acting assistant defence secretary for special operations/low-intensity conflict.

As ISIS loses territory it will become more reliant on virtual connections, he said, and continue to inspire "stray dog" attacks by vulnerable people.

Senators questioned the security officials about U.S. efforts to fight online recruitment of potential extremists.

"This is the new caliphate - in cyberspace," said Ron Johnson, the Republican chairman of the Senate Homeland Security and Governmental Affairs Committee.

The experts described an evolving threat including ISIS' ability to adapt its narrative after territorial losses to portray the struggle as a long-term process.

The internet is the primary tool for radicalization and no group has been more successful than ISIS in drawing people into its message, said Nikki Floris, deputy assistant director for counterterrorism at the Federal Bureau of Investigation.

In a possible reference to Trump's use of Twitter, Democratic Senator Kamala Harris asked Floris, "Has the FBI examined the role that social media posts or videos from our own government officials affect the online recruitment tactics used by ISIS?"