WASHINGTON—Islamist extremist social media lit up with celebratory messages as the Taliban cemented its control over Afghanistan this weekend, raising concerns that a weakened al Qaeda and other terrorist groups could stage a comeback in the wake of the chaotic U.S. military withdrawal.

U.S. officials, meanwhile, said they are likely to reassess their timeline for how rapidly al Qaeda’s core group, ravaged by years of U.S. counterterrorism operations, could reconstitute itself. The longstanding intelligence assessment had been 18 months to two years after an American military withdrawal, current and former U.S. officials said.

The U.S. invaded Afghanistan in response to the Sept. 11, 2001, terrorist attacks conducted by al Qaeda, a counterterrorism mission that President Biden said was completed long ago.

But jihadist groups saw the stunningly rapid sweep to power of the Taliban—which harbored al Qaeda before 2001 and hasn’t publicly broken with it—as validating their strategy of patience, analysts who follow their online postings said.

“This is without a doubt the most significant day for al Qaeda since 9/11,” Charles Lister, of the nonpartisan Middle East Institute, wrote in a post on Medium.com, saying the extremist group was in dire straits just weeks ago. “For the first time in years, not only does al Qaeda finally have some breathing space, it’s being gifted an enormously significant safe haven in which to rebuild.”

Pro-al Qaeda media accounts on Monday published an unsigned message congratulating “the brothers” in the Taliban on their victory.

“Afghanistan is Conquered and Islam has Won,” said the message, translated by the SITE Intelligence Group, which monitors extremist media.

Senior Taliban official Mullah Abdul Ghani Baradar, at front in the center, makes a video statement from an unidentified location on Monday.

Photo: Reuters

“For them, it illustrates that their ideology is correct, and that God is on their side, and it doesn’t matter how long it takes,” said Aaron Zelin, a fellow at the Washington Institute for Near East Policy think tank. “Everything that’s happened is seen as a prophecy fulfilled in many respects.”

Mr. Zelin cautioned that al Qaeda is a much-diminished organization when compared with the one that used Afghanistan as a safe harbor beginning in the 1990s. Much of its leadership, including founder Osama bin Laden, have been killed in U.S. raids and drone strikes; its current leadership is more local and regional than international; and it faces competition from groups like Islamic State, which also has battled the Taliban.

In an address on the crisis Monday, Mr. Biden said the U.S. has conducted counterterrorism operations in other countries without a large military footprint on the ground. “If necessary, we’ll do the same in Afghanistan,” he said.

Douglas London, a 34-year Central Intelligence Agency veteran with extensive experience in the Middle East and South Asia, said that even before the Taliban’s victory, al Qaeda sought to take advantage of the U.S. military withdrawal by moving personnel who had taken refuge in Iran back into Afghanistan.

Key figures from the group—and from local affiliate al Qaeda in the Indian Subcontinent—were among those released by the Taliban over the weekend from Bagram Air Base, the former American nerve center for the war effort, said Mr. London, author of a forthcoming memoir, “The Recruiter.”

The Taliban has also freed prisoners from Pul-e-Charkhi, another prison near Kabul.

“It seems inevitable that the Taliban will allow al Qaeda, ISIS, and other terrorist groups we haven’t even heard of yet to find sanctuary in Afghanistan,” John Bolton, who was national security adviser under former President Donald Trump, said Monday on Twitter. “It’s just intolerable that we’ve allowed this to happen.”

President Biden addressed the nation for the first time since Afghanistan fell to the Taliban and defended the exit amid rising criticism of his handling of the withdrawal of U.S. troops. Photo: Chris Kleponis/Zuma Press The Wall Street Journal Interactive Edition

U.S. intelligence agencies have long assessed that it would be up to two years after a full U.S. troop withdrawal before al Qaeda could again pose a threat to the U.S. homeland.

Pentagon spokesman John Kirby said Monday that Defense Secretary Lloyd Austin “certainly believes” a reassessment of the possibility for terrorist groups to reconstitute inside Afghanistan is in order following the Taliban’s rapid seizure of Kabul and the collapse of the U.S.-backed government. 

“But we’re in no position at this point just one day after the events in Kabul to make a firm judgment either way what that’s going to look like,” Mr. Kirby said.

When Mr. Biden announced the U.S. troop departure in April, top officials acknowledged the prospect that terrorist groups would seek to take advantage and that American spy agencies, which often rely on the military for support, would have diminished ability to track developments.

CIA Director William Burns told the Senate Intelligence Committee earlier this year that there was a “significant risk” that al Qaeda and other terrorist groups in Afghanistan would seek to rebuild after U.S. and coalition militaries departed. Mr. Burns said the CIA would retain “a suite of capabilities,” some already in the region, some that need to be developed, to protect U.S. interests.

Along with al Qaeda, Afghanistan has been host to an Islamic State affiliate, which has suffered major defeats in recent years at the hands of both U.S. and Afghan security forces and the Taliban. A report earlier this month from the Congressional Research Service noted that Islamic State and the Taliban have fought over territory because of political differences and said a Taliban military victory could have a negative impact on Islamic State’s presence in the country.

But the Taliban’s relationship with al Qaeda “is as firm as it’s ever been,” Mr. Lister of the Middle East Institute wrote.

Write to Warren P. Strobel at Warren.Strobel@wsj.com and Dustin Volz at dustin.volz@wsj.com