TUNIS The young man at the entrance to Zitouna, the oldest mosque in the Tunis medina, was adamant. Non-Muslims could no longer enter the building, not even just its outside gallery overlooking the busy souk.
"You can only come in if you declare, 'There is no god but God and Mohammad is God's messenger'," he said - effectively making conversion to Islam the new admission ticket to a monument that used to welcome non-Muslim visitors.
Hardline views like these have spread through Tunisia in the past two years as radical Muslims seized control of about a fifth of all mosques, attacked westernized liberals and tried to impose their puritan ideas on one of the most secular Arab societies.
The governing party Ennahda, which formally advocates a democratic form of Islamism, long treated the radicals mildly, seeing them as informal allies in reclaiming Islam's place in the small North African country.
But two assassinations of secular politicians this year widely blamed on militant Islamists alienated many Tunisians and united the secular opposition parties, powerful trade unions and other civil society groups against Ennahda.
"Ennahda now realizes the Salafis are very unpopular and it has to accept the opposition demand for new elections," said Alaya Allani, a historian of Islamism at Manouba University near Tunis. "It will not be the majority party after the next polls."
Geoffrey Howard, North Africa analyst at the Control Risks consultancy, said Ennahda was now far below the 37 percent it polled in Tunisia's first democratic election in 2011. "The party has been severely damaged by the latest crisis."
Tunisia was the first of the "Arab Spring" countries to overthrow its autocratic leader, president Zine al-Abidine Ben Ali, in January 2011 and the first to elect an Islamist-led government that October.
As in Egypt, which voted the Muslim Brotherhood into power the following year, freedom brought a wave of local radicals and foreign imams who preached a hardline Islam inspired by Saudi Wahhabism and other literalist schools from the Gulf.
Radicals took over around 1,000 of Tunisia's 5,000 mosques, which are normally run by the Religious Affairs Ministry, and turned them from quiet places of prayer to platforms to call for jihad and sharia (Islamic law).
Violent Salafi groups rioted over an art show they deemed blasphemous, demonstrated at Manouba University to demand that women students wear full face veils and patrolled some districts to pressure residents into following their puritan Islam.
In the assembly writing Tunisia's new constitution, Ennahda members have argued for it to include sharia, annul the gender equality brought in under previous secular rulers and drop references to international human rights conventions.
As the respected jurist Yadh Ben Achour put it in August 2012: "Religion has invaded the social and political debate to such an extent that we are starting to get indigestion ... The country's real problems have been pushed aside or put off indefinitely."
Tunisia is suffering from a severe fiscal crisis and high unemployment - other major factors in recent popular unrest.
Religious Affairs Minister Noureddine Khadmi said his staff have been able over the past year to roll back the number of Salafi mosques through persuasion, pressure and legal action.
"Now there are fewer than 100," he told Reuters in an interview. "In about 50 cases, we have called on the Justice Ministry to step in and resolve the issue."
In the case of the 1,300-year-old Zitouna, the imam now controlling it is not a Salafi but a staunch conservative who rejects state control over the famed mosque.
Khadmi said the government sought to "correct the religious landscape" after five decades of autocratic secularist rule and described its goal as "the coexistence of democracy and Islam".
But its record seems more favorable to the Salafis than he presents it. In its first year, the government approved three Salafi groups and Hezb ut-Tahrir, an international movement calling for an Islamic caliphate, as legal political parties.
It also registered about 200 new Salafi charities and schools and allowed radical preachers from the Gulf and Egypt to go on speaking tours around the country. "There is no control over their activities or revenues," Allani said.
Khadmi's image is also ambiguous. Critics say the minister, who sports a trim beard and stylish suit, was a fiery preacher calling for jihad at a radical mosque before his appointment. He dismisses this as lies from opponents of the 2011 revolution.
Ennahda's approach began to change in September 2012 after hundreds of radicals attacked the United States embassy in Tunis to protest against a film ridiculing the Prophet Mohammad.
Its resolve further stiffened this year as the jihadi group Ansar al-Sharia repeatedly clashed with army troops in western Tunisia, and following the assassinations of the two secular opposition leaders.
But it was only last week that Prime Minister Ali Larayedh banned Ansar as a terrorist group - after having previously described its training areas in the rugged western mountains as sports camps.
LOOMING DEFEAT AND SPLIT
Ennahda's ambiguous religious policies stem from its own internal conflicts, said Allani. He estimates that Ennahda's more liberal wing represents only one-third of the party base while two-thirds are conservative to hardline in their views.
Party leader Rached Ghannouchi has tried to balance between the two camps and is reluctant to confront the hardliners by cracking down on the Salafis, according to Allani.
Tension seems to be increasing in the ranks as Ghannouchi, sensing probable defeat at the polls due next year, tries to steer the party to a compromise with the secular opposition and the best starting position for its next electoral campaign.
"What you could see happening, if they perform very badly in the elections, is a split in the party, into either a more radical and a more moderate political wing, or into a political and a religious wing," said Howard.
"The liberal wing of Ennahda could be accepted by Tunisian society," Allani said. "There is a chance it could even be a partner in the next government coalition."
(Editing by Mark Heinrich)