The last time I was in Mosul a mortar exploded as I was walking across a U.S. army base with New York Times photographer Tyler Hicks.

Mosul wasn’t safe then. It certainly isn’t safe now, despite having been the intense focus of years of U.S. support that ended when President Barack Obama brought home all American troops from Iraq two years ago.

Iraq’s second-largest city was overrun on the weekend by Sunni extremists styling themselves representatives of the Islamic State of Iraq and the Levant. This is a potentially ominous development for Iraq and the region, and ultimately for all of us.

The insurgency has links to al-Qaida, although the groups had a falling out earlier this year because al-Qaida found the ISIL too extreme. Like the parent organization and its late leader, Osama bin Laden, its ambition is to create a caliphate — an Islamic religious empire.

These jihadis have already captured a large swath of northeastern Syria and northwestern Iraq and are now marching — more accurately, driving — on Baghdad in the Mad Max-style pickup trucks that they used to storm Mosul. On Wednesday they captured Tikrit, which was Saddam Hussein’s home town and power base, and were reported to be only about 100 kilometres from the capital, Baghdad. They were also moving toward Kirkuk, which has immense oil and gas fields.

Meanwhile, what has happened in Mosul has triggered an exodus of half a million refugees, fleeing east into quasi-independent Kurdistan.

Until now the jihadis, a large number of whom are Syrians, have made quick progress. Rather than fight, Iraqi police officers and soldiers have abandoned their posts en masse. But if the black-garbed Islamists close on Baghdad or Kirkuk, that will likely change. Iraq’s Shia majority, whose Iran-backed militias are now likely to grow, will not surrender. Nor will Iraq’s large Kurdish minority, which has a famously tough, formidable army — the pesh merga — and which considers Kirkuk its cultural capital.

Sunni insurgents in Iraq gained a lot of experience fighting U.S. forces after ISIL was created in 2004. They are well-armed and well-financed, especially after sacking Mosul’s armouries. Many images have been transmitted of them driving U.S.-supplied Humvees amid persistent Iraqi media reports that they had helped themselves to nearly half a billion dollars from Mosul’s central bank. If so, this would make them the wealthiest terrorist group on the planet.

For all these reasons the potential is very real in Iraq for the kind of mayhem and anarchy that has ripped Syria apart for two years.

The rise of these ultra-conservative religious zealots and the convulsions they’re causing in Iraq poses another challenge to Obama and American leadership. One of Obama’s biggest foreign blunders was to draw a line over the use of chemical weapons that he ordered Syria to not cross. When it did the president did nothing, raising hackles in Turkey, Jordan and Lebanon, and made a lot of would-be militants think they had been given a green light to do anything they pleased.

Obama probably prolonged Syria’s civil war by not attacking Bashar Assad last year. With Assad unchallenged and making territorial gains, Syria’s jihadis appear to have concluded it is easier to create their cherished caliphate by going through Baghdad rather than Damascus.

Obama has not done any better on most of his other foreign files lately. The president has been flummoxed by Russia’s seizure of Crimea and its machinations in eastern Ukraine, and by Chinese bellicosity in the East China and South China seas.

The Obama doctrine, as articulated in a confusing speech that the president gave at West Point last month, was that the U.S. will only use force if it is direct peril. In other words, Washington will sit this one out. And the next one, too.

To be fair, Obama didn’t create the mess in Iraq. He inherited it from George W. Bush, Dick Cheney and Donald Rumsfeld. But Obama is in charge and has 19 months left on his watch.

The most recent developments in Iraq present the president with a stark choice. He can give Prime Nouri al-Maliki’s army more and better weapons and equipment and run the risk of having them end up in the hands of bin Laden’s disciples, as has happened in Mosul. Or he can resist this temptation and risk Iraq’s total dismemberment.

One of the imponderables is whether the insurgents can hold Mosul. Al-Maliki has made loud noises about a counter-offensive. But the Iraqi leader said the same thing about Fallujah — where the U.S. marines spent so much blood and money — after it fell five months ago. Since then Iraq’s security forces have barely made an effort to make good on al-Maliki’s promise.

What is most likely is that a coalition of Kurdish pesh merga and Iraqi special forces will try to reverse the fundamentalists’ gains. It is even possible that the U.S. will end up having to quietly co-operate with Syria’s Assad, who in turn continues to be beholden to Iran.

It must make many who live in the Middle East pine for the less complicated days when Saddam ruled supreme.