The Iranian revolution just turned 40. In retrospect, was the revolution a success or a failure?

Well, it depends.

In 1979, when the Air France flight carrying Ayatollah Khomeini from his French exile landed in Tehran, expectations varied. The Iranian liberal intellectuals who had helped create the revolution wanted to replace the shah’s four-decade-old regime of corruption, subservience to foreign powers, and autocracy with a republic built on liberty, religious tolerance, and independence. (A smaller group wanted a Marxist revolution.)

The Western powers—led by President Carter—that had abandoned the shah because of human-rights violations wanted something similar, but they also wanted to influence the new authorities so they could continue to count on Tehran to protect their oil interests in the Gulf.

From those points of view, Iran’s revolution has been a miserable failure. It has long surpassed the shah’s own bad human-rights record, established a brutal theocracy, poisoned the Middle East with its violent religious imperialism, and isolated the country from the best that globalization has to offer in values, institutions, and trade.

The post-revolutionary generations despise the obscurantist regime. The country is now urbanized, and the middle classes embrace democratic rule, globalization, and secularism, as shown by every demonstration and survey in which they have participated at considerable risk. One million people took to the streets in 2009 against the electoral fraud that kept President Mahmoud Ahmadinejad in office until 2013. Massive repression and political manipulation preserved the regime from what looked like imminent demise.

Iranians continue to protest, in much smaller numbers and with subtler, ostensibly “social” pretexts, but they are not only questioning the regime’s economic incompetence, evident even before the international sanctions. The people’s motivation is profoundly political.

This perspective on the Iranian revolution 40 years on, however, is limited. One has to consider that the intellectuals who kicked off the revolution were not the main drivers in the end. When, under pressure, the shah allowed demonstrations in late 1978, it quickly became clear that the core of the revolution was Islamism. The intellectuals had, in the name of religious tolerance and free speech, asked for Islam to play a role in the future republic.

But the Islamic presence was an avalanche of religious sentiment guided by fanatics who understood their golden opportunity. Women draped in chador were far more numerous than the liberal and the left-wing intellectuals, and the exiled ayatollah quickly became the leading figure.

To those who wanted to replace the shah with a theocracy, these 40 years probably seem a success in the face of foreign enemies. The revolution has survived—its international presence is powerful despite the hostility of western liberal democracies and Sunni theocracies.

Iran has established a strategic presence in Lebanon, where Hezbollah, a Shiite militia close to Tehran, is part of the government. It has such an influence in Iraq, where it controls military bases, that all Iraqi leaders rejected President Trump’s statement that after leaving Syria the United States will stay in Iraq to surveil Iran.

In Syria, Iran-backed Shiite militias have played a key role in sustaining President Bashar Assad, making Russia, the Syrian regime’s other foreign ally, uneasy.

In Gaza, Hamas is a significant Iranian ally. Iran is involved in Yemen’s civil war and supports Shiites in the Gulf countries under Sunni control as well as Afghanistan and Pakistan.

Tehran is now working on an ambitious project—a corridor that will link Iran to Lebanon and the Mediterranean through Iraq and Syria.

All of this is done at the economic expense of the Iranian population and the revolution’s coffers—which is why the slogan “Neither Gaza nor Lebanon” is often heard in the daily protests that take place in Iran. But for the time being, and tragically for their victims, the religious and political authorities—protected by the Revolutionary Guard—do not seem to be in real danger.