Riot policemen protect the justice ministry building, as Tunisian Muslims are gathered in front of the justice ministry in Tunis, Nov. 6, as part of a demonstration by radical Salafi Muslims protesting against the imprisonment of hundreds of Salafist militants.

It seemed to him a dark time for Islam. Afghanistan and Iraq were under US assault. At home, President Zine El Abidine Ben Ali was jailing the pious under a new anti-terrorism law. Mr. Mezmi read about the struggles of the early Muslims, and was inspired.

“I felt the prophet was talking about our times and what was happening in the world,” he says.

Today Mezmi works as a tugboat engineer in Tunis. He’s also part of a deeply conservative – and sometimes violent - Islamic current known as Salafism that has gathered force in North Africa since the 2011 uprisings. It's inevitable that Salafis will help guide their countries’ evolution. The challenge for governments is to make sure they do so peacefully.

Salafis made international headlines in September with assaults on US embassies in Libya, Tunisia, and Egypt. While they have mainly acted as pressure groups so far, some leaders fearful of violence want to steer Salafi activists into politics instead.

“There must be zero tolerance toward violence,” says Said Ferjani, a political bureau member of Ennahda, the moderate Islamist party that leads Tunisia’s coalition government. “We have to bring them into the sphere of intellectual and theological debate, because where there is debate, you can challenge their views.”

Reversion to 'early Islam'

Salafis are Sunni Muslims who aim to emulate Islam’s first three generations, called “salaf” in Arabic, in a quest to transform society. But views differ on the right approach. Many Salafis simply try to set an example. Some get involved in preaching and charity work. A minority embrace varying degrees of violence.

The evolution of Salafi thinking dates to medieval scholars such as Ibn Taymiyyah. His call to scrap centuries of jurisprudence and return to the “pure” Islam of the prophet Mohammed's time has inspired generations of fundamentalist reformers.

One was the 18th century scholar Mohammed Ibn Abdel Wahhab, who branded other Muslims infidels – a widely reviled practice called takfir – and teamed up with the Al Saud family to seize control of central Arabia. His teachings now form the basis of Saudi Arabia’s state creed.

Most Salafi scholars, however, have warned against getting into politics. Sometimes called Scholastic Salafism, this school of thought urges Muslims to live piously and invite others to do likewise.

Both Salafis and more moderate reformers have long debated issues such as takfir, the concept of holy struggle called jihad, and the role of sharia – the comprehensive understanding of how Islam guides life. In recent decades a new discourse has offered stark answers.

Forged in the crucible of the 1980s Afghan war, the violent fundamentalism of Al Qaeda and its cheerleaders demands direct application of sharia, depicts Islam as under attack – including by some Muslim-world governments – and calls on Muslims to fight in its defense. Those who do so are often called Salafi jihadis.

Making sense of life

Meanwhile in North Africa, the regimes of Tunisia’s Ben Ali, Libya’s Muammar Qaddafi, and Egypt’s Hosni Mubarak spent decades trampling dissent, letting unemployment skyrocket, and seeking to varying degrees to control religious life.

For some North Africans raised in the bleak landscape of authoritarianism, Islamic activism offers meaning, says Isabelle Werenfels, a specialist on the Middle East and Africa at the German Institute for International and Security Affairs, in Berlin.

“Many of the people termed Salafi don’t really know much about Islam,” she says. “These are young people who don’t have many choices. They’re looking for a way to give sense to life.”

Mezmi has studied Islam for longer than many young Salafis, but he waited five years before he dared let his beard grow – a good way to attract the police in Ben Ali’s Tunisia. His friend Hamza El Arabi, an engineer at a plastics factory, also studied discreetly. The two men grew up in El Kram, a working-class neighborhood of Tunis. One recent evening they were sharing an outdoor café table with their friend Redouan, also a Salafi. Inside, dozens of eyes were glued to a soccer match on TV.

“Before, it was like I didn’t have an identity,” says Redouan, 26, who began studying Islam in 2010. In jeans and sneakers, he and his friends still look like most of the other young men at the café – save for their beards. “I was drinking and playing cards. And in Islam I found my identity.”

A slide toward intolerance

Since last year, a growing number of North Africans – mainly young men – has translated that sense of identity into action. Most Salafi activism has been peaceful. But violence has risen, from messy scraps between police and rioters to religiously-driven vandalism.

In Tunisia, Salafis have done charitable work and called for religious freedoms – such as lifting restrictions on Islamic dress – denied them under Ben Ali. But some have also lashed out at what they call blasphemy.

Demonstrations last year against a Tunis TV station that aired the film “Persepolis,” which contains an image of God, ended in rioting. Last June Salafi activists trashed an art show on similar grounds, with similar results.

In Libya, Islamic hardliners have wrecked several mosques associated with Islam’s mystical Sufi traditions. Sufis often congregate around spiritual leaders they believe transmit God’s blessing, and bury them inside mosques. To Salafis, that can look like witchcraft and polytheism.

“If these people controlled the country they’d kill everyone,” says Abdelbaset al Turki, a relative of Sheikh Abderrahman al Turki, who since 2003 has led the Sufi community at the Zaouia al Shaab mosque overlooking Tripoli’s harbor.

One morning in August, Abdelbaset al Turki watched Salafis bulldoze the Zaouia, pick-axe open graves, and pull out four bodies including Sheikh Abderrahman’s father and grandfather. Nominally pro-government militiaman on gun-mounted pick-ups blocked any interference.

Now the Zaouia al Shaab Sufis frequent the home of Sheikh Abderrahman, a converted garage, where one September afternoon Abdelbaset al Turki and his brother, Fathi, were having tea. Photos of robed figures hung on the wall. The men say rigid Salafi doctrines contradict Islam.

“Sufis know the history of Ibn Abdel Wahhab and the Wahhabi discord, and stay with the true belief,” says Fathi al Turki.

Just weeks after the Zaouia al Shaab was destroyed, four US diplomats were killed in an assault on the US consulate in Benghazi that US officials blame on a local Salafi Jihadi militia with possible links to Al Qaeda. Three days later, Salafi-led mobs attacked US embassies in Cairo and Tunis over an American-made film that lampooned the prophet Mohammed.

Mezmi and his friends blame such excess in part on a shaky grasp of religion. Several Salafi-led demonstrations in Tunisia have turned violent after hordes of young men – some perhaps Salafis, some apparently just poor and angry – seized the occasion to brawl with police.

“If Abou Iyadh calls for a demonstration, thousands of Salafis will turn out,” Mezmi says, citing a prominent Tunisian Salafi. “But so will thousands of other guys, because they’re Muslims, and some of them are ignorant and throw stones.”

The solution, they say, is better knowledge of Islam.

“We have sheikhs in Tunisia and abroad, like in Saudi prisons and in Yemen,” says El Arabi. “Their teachings are available online.”

Working within the system

However, that sort of ad-hoc study invites extremist ideas, says Mr. Ferjani, from Ennahda. His party wants to tackle job-creation while also training mainstream religious teachers to coax Salafis from society’s margins into political life.

In Egypt, that has already begun. Salafis generally stayed out of politics under Mr. Mubarak’s rule. Some objected on religious grounds to any semblance of democracy, however flawed. Others preferred to sit out a rigged game. But recently some have changed tack.

The Salafi Nour Party won nearly a quarter of seats in Egypt’s lower house of parliament, which has since been dissolved, in elections last year. It sees politics as a way “to express our own point of view, to have pressure power, and to participate in the next government,” says spokesman Nader Bakkar.

The Nour Party wants to put its stamp on Egypt’s new constitution. It strove to make a more direct connection to sharia via an article making the “principles of sharia” the main source of legislation and pushed hard – if unsuccessfully – for Cairo’s Al Azhar University, a leading Islamic authority, to vet laws for sharia compliance.

The prospect of Salafis in politics has gotten mixed reviews. While some Egyptians prefer them to the slick businessmen who rose to power under Mubarak, others worry of a clampdown on personal freedoms. As a Cairo taxi driver named Hossam put it, “they’ll make us stop listening to music and grow our beards.

In Tunisia, a leaked video in October showing Ennahda’s leader, Rached Ghannouchi, advising Salafis to work gradually, prompted liberals to cry conspiracy. Ennahda said the remarks, recorded last April, were taken out of context.

“Politics could bring an element of realism to [Salafis’] perceptions and approaches,” argues Ferjani. “They must make an adjustment, and that can only happen within the sphere of democratic interaction.”

Democracy vs. Islam?

In Tunisia, the newly-minted Reform Party hopes to play that role, says its president, Mohamed Khoja. Two decades ago his activity in underground Islamist circles earned him ten months in Ben Ali’s jails. Today his party wants to channel resurgent Salafi energy into politics.

“It’s not a choice between democracy and Islam,” he says. “The people can have political authority – what matters is that governance is Islamic and law adheres to sharia.”

For now, Mr. Khoja and his party are trying to win the ear of young Salafis. Winning their support may prove difficult. Many reject democracy as un-Islamic.

“’God’s governance but the people’s authority’ – that’s just philosophizing,” says Mezmi, using a term that in Islamic parlance often equates to “splitting hairs.”

He and his friends want to refashion society, but through other means than electoral politics.

“Governance should be what comes to us from God,” says El Arabi. “Not communism, not liberalism, not secularism. Only Islam.”