And last month, the United States Embassy in Nairobi warned of a possible terrorist attack against a major hotel in the Kenyan capital that is popular with tourists and business travelers. The warning did not specifically mention the Shabab, but intelligence officials said the threat bore the hallmarks of such an operation.

The Defense Intelligence Agency told the Pentagon’s inspector general in a recent report that the chances of the Shabab attacking the United States remained relatively low, but the analysts noted that the group had made clear its intentions to kill Americans at any location.

One threat could be home grown, from radicalized Somali-Americans living in cities like Minneapolis or Columbus, Ohio, which have large Somali-American communities, analysts said. Another could be from Shabab militants in East Africa, who have pilot training and might be able to slip into the United States — a much more difficult feat now than when the original Sept. 11 plotters entered the country in 2001.

For now, Shabab threats against Americans remain highest in East Africa.

In September, a suicide bomber detonated a car packed with explosives at the gate of a military airfield in Bale Dogle, Somalia, injuring one American service member. Afterward, according to the Pentagon’s inspector general report, the Shabab and other Qaeda-related groups released near-simultaneous messages on social media, suggesting a coordinated media strategy among the Qaeda branches.

“This is what we struggle with,” Brig. Gen. Dagvin R.M. Anderson, the commander of American Special Operations forces in Africa, said in an interview last month on the sidelines of a counterterrorism exercise in Mauritania. “Their intent is clearly stated. The question is, are they able to develop a safe haven to plan, fund and plot these attacks against the U.S.? What’s their timeline? How do we and our partners keep them off balance?”

It is unclear how the Shabab might try to exploit the spread of the coronavirus pandemic on the continent, where many countries face huge challenges responding to the crisis, General Anderson said on Friday in a separate telephone interview from his headquarters in Germany.

There are also now about 500 American troops in Somalia. Most are Special Operations forces stationed at a small number of bases across the country. Their missions include training and advising Somali army and counterterrorism troops and conducting kill-or-capture raids of their own.