Editor's Note: (Peter Bergen is CNN's national security analyst, a vice president at New America and a professor of practice at Arizona State University. Bergen's new paperback is "The Cost of Chaos: The Trump Administration and the World." The views expressed in this commentary are his own. View more opinion on CNN.)
(CNN) ISIS and al Qaeda have largely receded from the headlines. It's been three years since ISIS lost the last vestiges of the vast geographical "caliphate" that it had once lorded over in Iraq and Syria, while al Qaeda has found it hard to regroup after the death of its founder Osama bin Laden more than a decade ago.
Yet ISIS is far from defeated in its heartland. The United Nations points to the continued presence of ISIS fighters in Iraq and Syria, estimating their total strength to be between 6,000 and 10,000 fighters, according to a report published on Tuesday.
That strength was underlined by a dramatic prison break in January at a prison in Hasakah in northeastern Syria, where more than 3,000 ISIS fighters reportedly were held. ISIS fighters and US-allied Kurdish forces fought a 10-day battle at the prison, during which 100 to 300 ISIS fighters escaped, according to the UN report.
As a result of this resilience, the US continues a campaign of special operations forces ground raids and airstrikes against ISIS leaders. In February, Abu Ibrahim al-Hashimi al-Qurayshi, the group's leader, died in a US ground operation, while earlier this month, a US airstrike killed another militant who was part of the group's leadership, according to US Central Command.
But these military operations will not achieve much in the long term if the thousands of ISIS fighters and tens of thousands of displaced women and children from multiple countries remain unrepatriated in lightly secured and unsafe prisons and camps in northeastern Syria, creating what could be a whole new generation of ISIS recruits.
The solution is for the many countries that have their nationals in prisons and camps in northeastern Syria to take back their ISIS fighters for prosecution in cases where it's merited. As for women and children living in the camps, they should be reintegrated back into their home societies and entered into deradicalization programs if that should prove necessary.
Senior US government officials, speaking Wednesday at a conference at the Middle East Institute in Washington, stressed that ISIS is far from defeated. Joshua Geltzer, US deputy homeland security adviser, told me in a discussion at the institute that ISIS remains "a threat to countries where it continues to have a presence, which is about 30 countries worldwide. It is still a threat to the region, Iraq, Syria and neighbors. And it is still a threat to the United States and our allies and partners."
Of particular concern are more than 10,000 ISIS fighters and around 60,000 mostly women and children who are being held by America's Kurdish allies, the Syrian Democratic Forces, in prisons and camps in northeastern Syria. The United Nations estimates that 30,000 of those held in the camps are under the age of 12 and are "at risk of radicalization" by ISIS ideologues.
Few countries will take back their nationals who are living in the squalid camps, fearing that they may be importing an ISIS problem. In the past three years, Iraq has taken back more than 600 fighters and nearly 2,500 "displaced Iraqi nationals," according to Timothy Betts, the acting US special envoy for the Global Coalition to Defeat ISIS. This month, France took back 51 women and children, while 39 Americans have been returned to the United States, according to Betts.
Yet that number is less than 5% of the mostly 60,000 women and children -- the majority from Iraq and Syria -- and the more than 10,000 ISIS fighters who are being held in northeastern Syria.
At the current slow rate of repatriation, the ISIS fighters and tens of thousands of women and children might take decades to return to their home countries. By that time, even the youngest children in the camps could be adults in their 30s and will have spent almost their entire lives living in the filthy, disease-infested camps, which are ripe for ISIS indoctrination.
A wild card causing considerable consternation among US national security officials is the saber rattling by Turkey in recent weeks that it plans to send its military into neighboring northeastern Syria to annex territory controlled by the US-allied Kurdish groups fighting ISIS and running the facilities where the ISIS fighters and the women and children are being held. Turkey considers those Kurdish groups to be terrorists.
Dana Stroul, deputy assistant secretary of defense for the Middle East, warned last week, "The United States opposes any Turkish operation in northern Syria. Such an operation puts at risk US forces, the coalition's campaign against ISIS, and will introduce more violence into Syria. It would effectively end a ceasefire that has been in place for years at a time when violence is at its lowest levels since the onset of the conflict."
Also concerning is that the Taliban's return to power in Afghanistan almost a year ago because of President Joe Biden's foolhardy decision to pull out all US troops from the country has given both al Qaeda and ISIS greater room to maneuver there, according to Tuesday's UN report. Biden's move was bad policy, and the US pullout was terribly executed, allowing the Taliban to maintain their alliance with al Qaeda and to bar women from jobs and teenage girls from education.
The UN report noted that Ayman al-Zawahiri, who replaced bin Laden as al Qaeda's leader, is issuing "regular video messages that provided almost current proof of life" and "Zawahiri's apparent increased comfort and ability to communicate has coincided with the Taliban's takeover of Afghanistan. ..."
In Afghanistan, both ISIS and al Qaeda have acquired "night vision equipment, thermal imagers, and steel-penetrating bullets," according to the UN report.
The United Nations assessed, however, that -- for the moment -- al Qaeda does not pose an "immediate international threat from its safe haven in Afghanistan ... and does not currently wish to cause the Taliban international difficulty or embarrassment."
That's the good news. But the bad news, according to the UN, is that al Qaeda now has key allies within the Taliban's de facto government in Afghanistan, which will doubtless give al Qaeda more resources to regroup. Meanwhile, the local branch of ISIS in Afghanistan is now one of the "most vigorous" of ISIS' regional networks globally, according to the UN.
The global jihadist movement, whether in Afghanistan, Iraq or Syria, and whether part of ISIS or al Qaeda, is down but not out. And these groups will continue to take advantage of ungoverned or lightly governed spaces in the Muslim world, where they will remain a threat to the governments and populations of Muslim-majority countries -- and to the West -- for the foreseeable future.