Peter Bergen is CNN's national security analyst, a vice president at New America and a professor of practice at Arizona State University. He is the author of " United States of Jihad: Investigating America's Homegrown Terrorists ." The opinions expressed in this commentary are his.

(CNN) So it begins: The long-envisioned assault on Mosul, the hugely symbolic Iraqi city where Abu Bakr al-Baghdadi declared ISIS' self-styled "caliphate" more than two years ago.

Not only is Mosul Iraq's second largest city, it is also a key to ISIS' claim to have installed for the first time since the collapse of the Ottoman empire a genuine caliphate with millions of subjects and territory that once encompassed lands the size of the United Kingdom.

There is little doubt that ISIS will lose Mosul and likely before the next US president takes office. On Monday, the commander of the anti-ISIS coalition, US Lt. Gen. Stephen Townsend, released a statement saying the Mosul operation "will likely continue for weeks, possibly longer."

With the fall of Mosul, the ISIS scourge will be largely banished from Iraq. The terrorist army has already lost a procession of other significant Iraqi cities: Baiji, Falluja, Ramadi and Tikrit. ISIS' claim to rule a caliphate is now harder and harder to sustain as it loses city after city both in Iraq and in neighboring Syria.

On Sunday, ISIS surrendered the Syrian city of Dabiq without much of fight. This is another significant city for ISIS because the group believes that Dabiq is the site of a long-prophesied war between Islam and the West that its adherents believe will result in the victory of Islam and of ISIS. The group even named its English language magazine Dabiq in honor of the prophecy. The surrender of Dabiq is instead just one more in a string of defeats for the group in Syria.

The impending fall of Mosul coincides with the climax of the heated presidential election in the United States in which Republican nominee Donald Trump has made ISIS a key issue since the terrorist group's rise took place on President Obama's watch.

In the most recent presidential debate, CNN's Anderson Cooper asked Trump, "You bragged that you have sexually assaulted women. Do you understand that?" Trump dismissed this as "locker room talk" and then quickly pivoted, saying that the real issue was "a world where you have ISIS chopping off heads." Trump added, "I will knock the hell out of ISIS."

The impending fall of Mosul makes this Trump talking point somewhat moot and it will be interesting to see how Trump and Hillary Clinton handle any discussion of ISIS during the final presidential debate on Wednesday night, since it is abundantly clear that the US-led coalition is already knocking the hell out of ISIS.

But before anyone breaks out the champagne, even a victory in Mosul will not solve what ails much of the Middle East, because ISIS is not the fundamental problem; it is instead a symptom of larger, more intractable, problems.

ISIS arose, in large part, because the American-backed, largely Shia government in Iraq was marginalizing Iraq's Sunnis. The same is also true of the Shia-led government in Syria, which has inflicted a brutal war on much of its Sunni population.

Until there is genuine political accommodation between the Shia and Sunnis in Iraq and, down the road, in the even more complicated case of Syria, a son of ISIS will surely arise because Sunni militant groups like ISIS will continue to claim that they alone can really stand up to the Shia-led governments in Baghdad and Damascus.

Also, Iran and Saudi Arabia and its Gulf state allies are fighting well-funded proxy wars in both Iraq and Syria, where Iran-backed militias hold enormous sway. Unless there is some cold peace between the Iranians and the Saudis, this proxy war will continue to fuel anti-Shia militant groups such as ISIS.

The collapse of Arab governance across much of the Middle East also fuels groups like ISIS, because these militant groups thrive in failing and failed states such as Iraq, Libya, Syria and Yemen.

Beyond these macro problems, there are other challenges that will follow the fall of Mosul.

Follow CNN Opinion Join us on Twitter and Facebook

As ISIS loses in Mosul, not all of the thousands of ISIS fighters who are hunkered down in the city will be captured or killed. Where will they go? Will ISIS' Western fighters return to Europe to foment terrorism there? Will other fighters fan out across the Middle East to engage in more terrorism in the region? Both outcomes seem quite plausible.

When you take a bat to a beehive, you are going to enrage the bees you don't kill.

The fall of Mosul heralds the dismantlement of the ISIS caliphate -- a very positive development -- but let's not kid ourselves that victory in Mosul will be the beginning of the end of Sunni terrorist groups. Unfortunately, the scourge of Sunni militancy in the Middle East is likely to last for decades.