In an unassuming house on the Tunisian island of Djerba, Said al-Barouni embarked on a mission to safeguard his Muslim community's little-known heritage, using technology and AI to save age-old religious manuscripts.
The 74-year-old librarian and member of the Islamic offshoot Ibadism took up the reins of his family's six-generation library in the 1960s and has been in a race against time to preserve whatever Ibadi manuscripts he can find.
"Look at what Djerba's humidity has done to this one," he said, his gloved hand bearing a tarnished piece of paper inside a climate-controlled room.
Today, the library holds over 1,600 ancient Ibadi texts and books on various topics, including astrology and medicine, dating from as early as 1357.
But Barouni is still on a quest to gather more literature, which has been scattered for centuries among families after they resigned themselves to practising their faith in secret.
After disagreeing on the succession following the death of Prophet Muhammad in 632 AD, Ibadis were considered Kharijites, an early divergent branch of Islam whose adherents were labelled heretics.
They fled to remote areas in modern-day Oman -- where most Ibadis today live -- as well as Libya, Tunisia and Algeria.
In North Africa, they established a capital in Tihert, today's Algerian city of Tiaret, but their newfound peace was short-lived when the Shiite Fatimid dynasty swept through the region in the 10th century and chased the Ibadis out of their main urban hubs.
"In order to preserve their existence, Ibadis took refuge on the island of Djerba, in the desert in Algeria, or in the difficult (to access) Nafusa mountains in Libya," Zohair Tighlet, an author and expert on Ibadism, told AFP.
They were faced with two options, he added, "to take on a never-ending war and disappear, like other minorities, or accept a state of invisibility and use it to begin a cultural rebirth".
Today most of their manuscripts are held in family libraries, said Barouni.
"All families in Djerba have libraries, but a lot of the manuscripts were sold or exchanged among different people."
In the small conservation room, heaps of weathered books stand amid the humming of ozone generators, which help mitigate paper deterioration by preventing harmful organisms such as mould from taking hold.
The manuscripts are dusted and scanned for digital copies, which Barouni believes is "today's only solution" to preserve the old texts.
Because old Arabic cursive is challenging to modern readers, Barouni also started using Zinki, an AI software able to read and simplify the ancient writings.
For Feras Ben Abid, a London-based Tunisian software engineer who founded Zinki, the tool enables access to a myriad of manuscripts the average reader couldn't decipher.
It is also a way to "change misconceptions some have had on certain topics", like Ibadi heritage.
Ibadism has historically incurred the wrath of both Sunni and Shia rulers, such as the Umayyad and Fatimid dynasties respectively, by adhering to the idea that any Muslim, regardless of lineage, can become the next leader after the death of the prophet.
"They call us Kharijites, as if we were against the religion," said Al-Barouni. "But no, we were against tyrants."
Presenting themselves as "democrats of Islam", Ibadis have a tradition of entrusting a council of elders to oversee the community's social and political issues "with the goal of preserving Ibadite society", said Tighlet.
That system was brought to an end under the French protectorate of Tunisia.
Those in present-day Tunisia found safety in Djerba -- a haven for minorities that was added to the UNESCO list of World Heritage Sites last year for its unique settlement pattern.
The resort island is also home to a Christian Catholic group and one of the region's biggest Jewish communities outside of Israel, with over 1,500 members of the faith.
Nestled on their Mediterranean island, the Ibadis settled for a new and quiet life, contributing to its modern-day cultural kaleidoscope and accounting for two-thirds of its population, said Tighlet.
Ibadis "brought a particular urban theory, which was among the reasons the island was listed in UNESCO's World Heritage Sites," added the expert.
They adopted an unpretentious and frugal way of living, often reflected in their architecture with white-washed, nondescript mosques, small minarets, and no outward-looking windows.
Some of their mosques were built underground, "both for safety and symbolic reasons", whereas other temples rim the island's shore in order to remain on the look-out for enemy ships.