When night falls on the street outside Tripoli's Abdullah Eshaab mosque, theological discussions often break out. Lately, they have taken place at the point of a gun.
On three occasions this month, groups of ultra-purist Islamists have turned up at the mosque gates after dark, armed with Kalashnikov rifles, 106-mm anti-tank cannon and truck-mounted Grad rockets, according to a cleric at the mosque.
They want to demolish the tomb, inside the mosque, of Suleiman Al-Feituri, a 12th-century holy man, because they consider such tombs as idolatry.
Facing off against them are the mosque's own, more moderate worshippers backed up by a militia unit armed with automatic weapons and two pickup trucks with anti-aircraft guns mounted on the back.
So far we've been trying to negotiate with them but if it does not work we will use force, said Omar Hajaj, a 30-year-old businessman who is also assistant to the cleric in charge of the mosque.
They are a bunch of extremists who do not want this country to settle down, he said, as the mosque's security detail stood outside with the safety catch off on their weapons. We warn everyone of the danger of these people.
Freed from Muammar Gaddafi's repressive 42-year rule, Libyans are now considering what kind of Islam they want and how big a role it should play in their everyday lives.
The process has turned into a contest between mainstream Muslims, on the one hand, and on the other, Islamists who follow a stricter interpretation of the faith and believe it should inform society's rules and government policy.
There's a huge amount at stake. Both sides have large quantities of weapons, and the outcome could also determine who ends up with political power in the new Libya.
So far the Islamists -- who are better organised and offer an ideology that appeals to the young and disenchanted -- are the ones filling the vacuum left by Gaddafi's fall.
It is the law of physics, said Salah Ingab, a Libyan writer on Islam who is concerned about the rise of the Islamists. An area of low pressure is filled from an area of high pressure. This is what is happening with Libya.
BURQAS AND BEARDS
The resurgence of Islamist ideas has become a feature of the Arab Spring uprisings across the region. In Tunisia, a moderate Islamist party now leads a coalition government. In Egypt, the Muslim Brotherhood is poised to do well in a parliamentary election.
In Libya too, Islamists have made their mark on the political landscape now taking shape.
Abdel Hakim Belhadj, a former Islamist militant who spent time with the Taliban in Afghanistan but now says he has renounced violence, heads one of the country's most powerful militias.
Mustafa Abdel Jalil, the head of the National Transitional Council, Libya's caretaker leadership, has said he wants the new order to be based on Islamic sharia law and that a ban on polygamy will be lifted.
The Islamists' political role is in flux. In a caretaker cabinet announced last week, there was only one minister, for religion, who is an acknowledged Islamist. The full extent of their influence may not become clear until an election is held, probably around the middle of next year.
But on the streets and in the mosques, there is no doubt that more hardline brands of Islam are gaining strength.
Men with long beards and white robes -- the trademark dress of Salafists, followers of a purist interpretation of Islam -- can now be seen on the streets.
Under Gaddafi, who waged a 15-year campaign to stamp out Islamists who he thought were trying to overthrow him, those outfits would have attracted the attention of domestic intelligence agents.
Many Salafists were jailed by Gaddafi and those not imprisoned spent years avoiding any outward manifestation of their beliefs.
The majority of Libyan women have long worn the hijab, or Islamic headscarf. Now some can be seen shopping at Tripoli markets in the burqa, a head to toe covering that masks the face.
At Friday prayers last week at Al Nafathy mosque, which until now has attracted followers of traditional, mainstream Islam, the sermon was given by a new cleric, who spoke of the evil arising from the free mixing of men and women in public, and railed against the spread of songs in general and Western music in particular.
Both are themes favoured by Salafists, but until now unfamiliar to Libyans.
A meeting of senior Muslim clerics in a Tripoli hotel this week adopted a recommendation that anyone who drinks alcohol should be barred from senior government posts.
The sale of alcohol has been illegal in Libya for decades, though it is available on the black market.
If he repents, it's not a problem, for someone to join the government, said one of the clerics.
Many Libyans say the freedom to worship as they choose is one of the benefits of the revolution.
During Gaddafi's time, people who came to dawn prayers were arrested, said a muezzin, who pronounces the call to prayer, at a mosque in Tripoli's old city.
The police thought they were too religious and people were afraid to come, they were tortured. All the religious people were afraid to come to the mosque, said the man, who did not want to give his name.
Now more people are coming. There is complete freedom.
For many, the new piety takes some getting used to.
Many are dressed like people from Kandahar, he said, referring to the Afghan city where the extremist influence of the Taliban is strong.
Some people are sanguine.
I am not afraid of Islamists in Libya. This is a moderate country and even if there is a small element of radicals, they won't be able to push their way through, said Houda, a 21-year-old engineering student.
Abdel Jalil was wrong to talk about polygamy ... but we see it as a mistake and we forgive him, she said.
Others are very worried.
Ingab, the writer on Islam, says he is a devout Muslim who prays five times a day. But he says there is nothing in the Koran to say that woman should wear veils or that governments should impose Islamic laws.
The ring tone on his mobile phone is a song by American singer-songwriter Bob Dylan.
My friend said to me: 'He is a Jew.' I said I don't care. That is his problem. I do not care if he worships a cow. I love Bob Dylan.
He pulls out a manuscript he wrote challenging the Islamists' interpretation of the Koran.
The time is not right to publish this because I will be killed on sight, he said. It contains loads of things they disagree with. The Salafists are just ignorant people.
In the courtyard at Abdullah Eshaab mosque, Hajaj, the deputy imam, gets out his laptop. With the mosque's armed guards standing nearby, he scrolls through photographs showing tombs that hardline Islamists have managed to destroy.
Some Islamists believe that tombs are a corruption of Islam's teachings because they turn graves into shrines and distract from the worship of God.
One image showed a small building in Misrata, 200 km (125 miles) east of Tripoli, in ruins. Hajaj said that was all that was left of the 400-year-old tomb of holy man Sidi Hamed al-Bikr, after the attackers fired anti-tank guns at it.
In Derna, near Libya's border with Egypt, he said Salafists had demolished the tomb of Sidi Nasr Aziz. He was a sheikh, or holy man, reputed to have been a companion of the Prophet Mohammed.
On the other side of Tripoli were more wrecked tombs. Attackers broke into the Sidi Nasr mosque at night, when no-one was there, said the head cleric there, Omran Ali Dayek.
They destroyed two tombs: one to a holy man who died in around 1760, and another to a sheikh who died 15 years ago. They removed the body from the more recent grave, and were about to dig up the second when they were disturbed and fled.
We went to all the graveyards in the area looking for the body but we could not find it. His family came here crying, asking where the body is, said Dayek.
In the room where the tombs used to be, there are fresh concrete slabs where workers have covered up the graves.
Mosque-goers say the new authorities seem reluctant to take on the radical Islamists.
They point across the road at the offices of the state oil company, where a security camera points at the entrance of the mosque. They say it must have recorded the attack, but that the oil company will not surrender the tape.
Lots of people have come here to ask questions and take photographs, but nobody does anything, said Dayek.
(Additional reporting by Ali Shuaib, Taha Zargoun, Marie-Louise Gumuchian and Oliver Holmes in Tripoli; Editing by Sonya Hepinstall)