PARIS—Those of us who lived through long days and longer nights in Cairo’s Tahrir Square in 2011, back in those early hours of what was called the Arab Spring, remember the excitement, the enthusiasm, and the hope that filled the air like the evocative scent of the jasmine necklaces sold on Egypt’s streets. But, like the flowers, the hopes faded quickly, and wilted, and were thrown in the dust. And one wonders if the optimism of that moment can ever be brought back.

Within months of those first popular uprisings, the Arab Spring turned to a long and brutal winter. New dictatorships replaced the old in some parts of the Middle East. Other countries descended into chaos and civil war, pushing millions of refugees across borders, not only in the region but into Western Europe.

Then, in the middle of the decade, the so-called Islamic State seemed to come out of nowhere to conquer huge swathes of Syria and Iraq.

As the scholar Gilles Kepel writes in his new book, Beyond Chaos, to be published in French this month, the aspirations and euphoria of the Arab Spring quickly became the “hostages” of the jihadists as ISIS spread its influence “from Mesopotamia to the marginalized European banlieues.”

ISIS inspired or directed terror attacks from Paris to Orlando, San Bernardino to Berlin, fueling instinctive xenophobia and fear in Europe and the United States, driving engines of radical right-wing populism in Western politics, helping to sunder the United Kingdom from the Continent and push Donald Trump into the White House.

Today, after vast bloodshed, the Islamic State that had as its motto “endure and expand” has proved able to do neither. It is little more than a vestigial collection of fighters on the run, trying to survive in a small corner of Syria with a few outposts scattered from Nigeria to Afghanistan. It also has a much reduced presence on that other great battleground, the Web.

The mosque in Mosul, Iraq, where Islamic State leader Abu Bakr al-Baghdadi proclaimed himself caliph of a new theocratic empire in the summer of 2014 was reduced to rubble in the summer of 2017. On the shattered minaret soon afterward someone scrawled “Fuck ISIS.”

But while the threat of the Islamic State as such was crushed by the concerted action of a wide coalition, led first by the Obama administration and then Trump, its near-elimination has not brought peace to the region, and we could well be headed toward a vortex of devastating violence.

What we see now is, to borrow a clichéd phrase from Samuel Huntington, a clash of civilizations, but as Kepel points out, at its core this is not so much a clash between the West and Islam, it is within Islam itself: the conflict between Sunni and Shia that dates back to battles for succession following the death of the Prophet Muhammad more than 1,300 years ago.

It was this ancient divide, in fact, that the Islamic State and the terror organizations that preceded it in Iraq exploited and exacerbated with such startling success. Under Abu Musab al-Zarqawi, they began by fighting the American occupiers after the overthrow of Saddam Hussein in 2003. But the great enemy of Zarqawi and later of his heir, Baghdadi, was not the United States, it was Shiite Iran and the governments in Damascus and Baghdad that were beholden to Tehran.

ISIS was a glaring symptom in this epochal conflict, not the disease itself, and today, with ISIS neutralized, the Sunni-Shia split can be seen more clearly for what it is: the framework and also the excuse for increasingly bitter, increasingly out-of-control national rivalries, with the Kingdom of Saudi Arabia and its Sunni allies pitted against the Republic of Iran, with its Shiite and Syrian Alawite clients.

For years now the two sides have waged gruesome proxy wars on the complex Syrian battleground and in deeply tribal Yemen, at enormous cost to the people of both countries. But there is little sign that the Iranians or Saudis will back off. Far from it.

Earlier this year, Saudi Crown Prince Mohammed bin Salman, widely known as MBS, ruled out any chance of reconciliation with Iran, and painted the conflict in blunt theological terms. Tehran’s ultimate aim, he said, is to take control of Mecca, the holiest site in Islam. “We won’t wait for the battle to be in Saudi Arabia,” the prince declared in a lengthy television interview. “Instead, we will work so that the battle is for them in Iran, not in Saudi Arabia.”

MBS has said that if Iran re-starts its nuclear program—made more likely by the Trump administration’s Saudi-backed efforts to destroy the agreement that froze it—Riyadh will pursue a nuclear program, too. For the record, MBS claimed, as Iran claims, it would be for purely peaceful purposes.

Meanwhile, by all indications both countries carry out covert operations against their opponents and each other. Over the last few months alleged Iranian agents have been arrested in Austria, Belgium, and France for a plot to bomb the rally of an opposition group near Paris where Rudy Giuliani and other dignitaries were speaking. The U.S. has shuttered its consulate in Basra, Iraq, for fear of Iran-backed attacks. Meanwhile a Sunni terrorist group hit a military parade in the Iranian city of Ahvaz, killing 25 people before the five attackers died. The remnants of ISIS claimed responsibility, but the Iranians blamed Saudi Arabia and its American backers.

In such a fraught environment, there is a constant threat that miscalculation will lead to open and escalating warfare. The Trump administration, with its unquestioning support for the Saudis and its uncompromising hostility toward Iran, has not only picked sides, it has put itself in the middle of the conflict, a position that will leave it under enormous pressure to get involved militarily if there’s open war.

Israel, once at the center of all discussions about war and peace in the Middle East, has built a none too secret alliance of convenience with the Saudis, focusing on their mutual hatred for Iran.

Russia, for its part, has used the Syria war to help reestablish itself as a global power, playing the complex game of enemies and friends in the Middle East so adroitly that in some circles it’s said Vladimir Putin must be a Muslim, since he has four wives: Israel, Saudi Arabia, Iran, and Turkey. The alliances and enmities among them often shift, but Putin exploits them all.

None of that does any good to the people in the region. Just ask the families of those slaughtered in Syria by Russian bombs.

Is there no way out of this perilous spiral?

If we look carefully at what happened in the Arab Spring, brief as it was, there may be lessons to be learned and some slight glimmer of optimism.

The rebellion against the old order in the Muslim Middle East usually is traced to popular outrage in Tunisia that erupted after a young vegetable seller, frustrated and humiliated, set himself ablaze in December 2010. By the time he died in January, Tunisia’s ruler was losing his grip on power, and political unrest had begun to spread east, a slow-moving and apparently unstoppable wave of emotion and dissent that looked like it would sweep the decades-old dictatorships and dynasties out of power from Libya to Egypt to Syria and beyond.

The surge of discontent caught governments, diplomats and journalists by surprise. Even terrorists were stunned: Al Qaeda, which had dominated the political narrative for a decade, suddenly seemed irrelevant in the face of the huge peaceful uprisings televised around the world.

In hindsight, of course, we should have seen this coming. Everyone knew that the majority of people in the Middle East were not yet 30 years old. In many countries the median age was in the teens. And many if not most of the young felt almost as frustrated and humiliated as that vegetable seller in Tunisia.

Everyone knew as well, because it was inescapable, that a region where information had always been tightly controlled underwent a communications revolution in the 1990s and the first decade of this century, beginning with satellite television news, then the internet, and finally and most importantly and universally, with cell phones.

The young were no longer just a majority, and no longer just frustrated, they were connected to each other and to the world as none of their parents had ever been. That demographic and digital convergence suddenly made the impossible seem possible. In Egypt, without question, the demonstrations in venerable Tahrir Square were inspired by accounts of police abuse on Facebook.

A sea change in the lives and the futures of the people of the Middle East seemed imminent, one that held the promise of freedom and prosperity. And such hopes were not limited to the Arabs.

A year and a half before the demonstrations in Tahrir Square, Iranians had poured into the streets of Tehran to protest the fraudulent re-election of President Mahmoud Ahmadinejad, an Iranian right-wing populist who squandered the state’s wealth and cracked down on personal freedoms as he tried to assure his political future.

“ Any new revolutions, if they are youth uprisings in the liberal, hopeful mold of what we saw at first in Tahrir Square, will have to be home grown, and massive, but they can’t be inchoate. ”

The scope of the popular demands in Iran was limited. The other candidates who might have been elected were not likely to overturn Iran’s Shia theocracy, and most Iranians who had memories of the 1979 revolution were not ready for another one. But they wanted their democracy to be something more than a complete sham. They wanted their votes and their voices to count. The mass demonstrations shook the regime, were met with brutal repression, and finally were crushed. But they had shown the potential power of spontaneous protests.

They should also have shown the risks when a mass movement lacks sufficient organization. In Tahrir, there was a great deal of optimistic talk in the early days about crowdsourcing the leadership of the uprisings. But while crowds make for impressive demonstrations, they’re not much good leading revolutions in the face of all the reactionary forces those unleash.

In Egypt, the crowds provoked the fall of President Hosni Mubarak, but highly organized opportunists—the fascistic Muslim Brotherhood and the deeply self-interested Egyptian military —soon vied for control, leaving the idealists in despair, in prison, or dead.

As Hussein Agha and Robert Malley wrote a few months afterward, the day Mubarak was forced to step down, February 11, 2011, “was the culmination of the Arab revolution. On February 12, the counterrevolution began.”

In Libya, the tyrant Muammar Gaddafi struggled to hold on, and probably would have if the French and Americans had not intervened. In Syria, Bashar al-Assad did manage to survive by jailing, torturing, and slaughtering hundreds of thousands of people.

Any new revolutions, if they are youth uprisings in the liberal, hopeful mold of what we saw at first in Tahrir Square, will have to be home grown, and massive, but they can’t be inchoate. Their leadership may be elected but can’t be crowdsourced. They will have to build organizations that can speak for the masses, but can also channel their strength.

The dictators will do what they can to thwart them, and with more energy than Tunisia’s Ben Ali or Egypt’s Mubarak were able to muster in 2011. But, to paraphrase Jim Morrison, the old have got the guns, the young have the numbers. There will come a moment when those will count.

Over the near term, Kepel suggests Iraq—after the tyranny of Saddam, the arrogant stupidity of the American invasion, the grim carnage of civil war, and the ghastly rise of ISIS—may be the best and most important place to begin rebuilding. The reconstruction of Mosul, for centuries one of the most cosmopolitan cities in the Middle East with a mixed population of Sunnis, Shias, Kurds, Christians, would be a good place to try to start.

For my part, after this brutal decade, I hope that Egypt, where I lived for several years, can find its way out of the iron grip of its current military leader, and back to the sort of optimism we all saw in the first days of the demonstrations in Tahrir Square.

There are several ways to say good morning in Egyptian Arabic, and one is “Sabah al ful,” wishing you a morning with the scent of jasmine. That and the air of freedom, prosperity and hope are nothing less than Egypt’s people deserve.

Keep Reading for more Daily Beast 10th Anniversary Coverage: