During Friday prayers the congregation of Muhammad Yousef, a young puritanical preacher in the Egyptian town of Mansoura, once spilled out into the alleys surrounding his mosque. Now Sheikh Muhammad counts it a good week if he fills half the place.

In Cairo, 68 miles to the south, unveiled women sit in street cafes, traditionally a male preserve, smoking water pipes. Some of the establishments serve alcohol, which Islam prohibits. "We're in religious decline," moans Sheikh Muhammad, whose despair is shared by clerics in many parts of the Arab world.

According to Arab Barometer, a pollster, much of the region is growing less religious. Voters who backed Islamists after the upheaval of the Arab Spring in 2011 have grown disillusioned with their performance and changed their minds. In Egypt support for imposing sharia (Islamic law) fell from 84 percent in 2011 to 34 percent in 2016. Egyptians are praying less, too.

In places such as Lebanon and Morocco, only half as many Muslims listen to recitals of the Qur'an today, compared with 2011. Gender equality in education and the workplace, long hindered by Muslim tradition, is widely accepted. "Society is driving change," says Michael Robbins, an American who heads Barometer.

But so, too, is a new crop of Arab leaders, who have adjusted their policies in line with the zeitgeist. They are acting, in part, out of political self-interest. The region's authoritarians, who once tried to co-opt Islamists, now view them as the biggest threat to their rule. By curbing the influence of clerics they are also weakening checks on their own power. Still, many Arab leaders seem genuinely interested in molding more secular and tolerant societies, even if their reforms do not extend to the political sphere.

The United Arab Emirates (UAE) has led the way in relaxing religious and social restrictions. While leading a regional campaign against Islamist movements, Muhammad bin Zayed, the crown prince of Abu Dhabi and the UAE's de facto leader, has financed the construction of Western university branches and art galleries. He has encouraged young women out of domestic seclusion and into military service, his daughter included. Female soldiers often walk the streets in uniform. In marked contrast to the region's post-independence nationalist leaders, who purged their societies of Armenians, Greeks, Italians and Jews, he has embraced diversity, though tough restrictions on citizenship persist.

In Egypt, President Abdel-Fattah al-Sisi has not only banned the Muslim Brotherhood, the region's pre-eminent Islamist movement, but denounced Al-Azhar, the Muslim world's oldest seat of learning, for "intolerance." He has closed thousands of mosques and said that Muslims must not sacrifice sheep in their homes during festivals without a license. On some beaches, burkinis — body-covering swimwear for conservative women — are banned. In a break from his predecessors, Sisi has attended Christmas mass in Cairo's Coptic cathedral three years in a row (though he doesn't stay long). "We're becoming more European," explains an Egyptian official.

The most remarkable, albeit nascent, transformation is in ultraconservative Saudi Arabia, where Muhammad bin Salman, the young crown prince, has curbed the religious police, sacked thousands of imams and launched a new Center for Moderation to censor "fake and extremist texts." Women will soon be allowed to drive cars and enter sports stadiums.

They are already encouraged to work. Now Prince Muhammad wants to create a new city, Neom, that seems modeled on freewheeling Dubai. Its promotional videos show women without headscarves partying with men. "We are only returning to what we used to be, to moderate Islam, open to the world and all religions," he told foreign investors in October.

This move to moderation is far from ubiquitous. In countries with less dynamic governments, such as Algeria, Jordan and Palestine, polls show that support for sharia and sympathy for Islamist movements is high and growing. But secularists can been found in even the most conservative quarters. Freed from the grip of Islamic State (IS) jihadists, residents of Mosul, in Iraq, congregate in revamped cafes that have sprouted around the city's wrecked university. Many profess to be atheists.

Economic hardship, long seen as fueling Islamist opposition movements, may also be eroding traditional views on women's role in society. Amid soaring inflation and subsidy cuts in many countries, one salary is rarely enough to support a family. So husbands encourage their wives to work. Daughters are leaving their homes in rural areas to study or work in cities.

All of the change is bittersweet for the region's liberals, who want more political openness, too. But Arab leaders are acting much like Kemal Ataturk, Turkey's dictator in the early 20th century, who abolished the caliphate and sharia, and banned traditional garb, all while consolidating his own power.

In implementing his modernizing agenda, Prince Muhammad has downgraded his family's 250-year-old alliance with the Wahhabist clergy, who enforced a puritanical version of Islam and seemed to rule Saudi Arabia alongside the House of Saud. Now clerics who push back too hard against decrees are muzzled — or arrested.

Similarly, Sisi fans criticism of religious movements, while censoring even indirect barbs of his rule. He has banned hundreds of newspapers and websites, and muzzled artists and musicians who might provoke opposition.

Yet many Arabs seem ready to forfeit political rights in exchange for personal liberties. A poll this year named the UAE as the state Arabs most want to live in, despite its dearth of democratic rights. But secularization may last only as long as the despots pushing the plan.

And even they may not go as far as activists want. No sooner had Saudi women won the right to drive than some took their bicycles out on the roads, testing the limits of official tolerance.