Sufis strive to protect their heritage in war-torn Libya
A handful of students sit cross-legged on the floor of the mosque in the Asmariya zawiya, transcribing on wooden tablets as their teacher chants Qur'anic verses.
Elsewhere in the complex, named for its 16th-century founder Abdessalam al-Asmar, scholars pore over old manuscripts on theology and Islamic law.
The zawiya -- an Arabic term for a Sufi institute offering a space for religious gatherings, Koranic education and free accommodation to travellers -- also includes a boarding school and a university.
Historian Fathi al-Zirkhani says the site is the Libyan equivalent of Cairo's prestigious Al-Azhar University, a global authority in Sunni Islam.
But despite Sufism's long history across North Africa, Libya's plunge into chaos after dictator Moamer Gadaffi was ousted in a 2011 revolt gave a free hand to militias.
They included hardline Islamists, who are deeply hostile to Sufi "heretics" and their mystical nighttime ceremonies aimed at coming closer to the divine.
"(Previously) dormant ideological currents, with backing from abroad, took advantage of the security vacuum to attack the zawiyas," Zirkhani said.
In August 2012, dozens of Islamist militants raided the site, blowing up part of the sanctuary, stealing or burning books and damaging Asmar's tomb.
But today, craftsmen are busily restoring terracotta tiles and repairing damage caused by the extremists.
The tomb is surrounded by scaffolding but still bears its green silk cover, delicately embroidered with gold.
The zawiya hosts several hundred students, including many from overseas, who enjoy free food and lodging.
"I came to Libya to learn Koran here," said Thai student Abderrahim bin Ismail, in faltering Arabic.
Houssein Abdellah Aoch, a 17-year-old from Chad wearing a long blue tunic, said he was working hard to commit verses to memory.
"I'm hoping to memorise the entire Koran then go home and become a religious teacher," he said.
When the call to prayer rings out, all rise and head through an arcaded courtyard to the mosque for noon prayers.
It is a scene repeated daily for hundreds of years, but the zawiya has had a turbulent few decades.
Kadhafi, who ruled Libya with an iron fist for four decades after seizing power in a 1969 coup, was suspicious of the Sufis.
"He infiltrated the zawiya with his secret services, creating a climate of fear and mistrust," said an employee, who asked to remain anonymous.
"Kadhafi chose to divide the Sufis to control them better."
But Kadhafi's authorities "loosened the stranglehold in the mid-1990s, which allowed the zawiyas to regain their autonomy," he added.
After Kadhafi's overthrow in 2011, another danger emerged. The attack in Zliten, on the Mediterranean coast east of Tripoli, was echoed across the country.
Islamist militants used diggers and pneumatic drills to destroy numerous Sufi sites across Libya -- attacks echoed in Iraq, Pakistan and elsewhere.
Zirkhani says the people who attacked the complex in Zliten were "extremists known to the state".
But in the chaos of post-revolt Libya, they have never been held to account.
The zawiya has also suffered from a lack of funds as it seeks to rebuild and restore its treasures.
Zirkhani showed AFP dusty old manuscripts he wants to preserve for posterity.
"We have neither the means nor the know-how to restore them," Zirkhani said. "We need help from (UN cultural agency) UNESCO and European institutions."
But there are some signs of hope for Sufis in Libya.
The zawiya was closed for six years following the 2012 attack. But in 2018 it discreetly reopened, and Sufis have been able to exercise their customs more publicly.
Last October in Tripoli, they took to the streets of the old city to celebrate the birthday of the Prophet Mohammed -- a festival frowned upon by more austere currents of Islam.