Morocco is promoting its moderate version of Islam as a counterweight to the widening jihadist threat in the Sahara, training hundreds of imams from affected countries, but analysts question its motives.
The initiative is well-timed.
Islamist violence is plaguing Libya and Nigeria, Mali is still recovering from an Islamist takeover of half the country, and Tunisia is increasingly nervous about the return of battled-hardened nationals fighting for Al-Qaeda-linked groups in Syria and Iraq.
Morocco has kept a tight grip on the religious sphere, which is closely tied up with the monarchy's legitimacy.
King Mohamed VI, who claims descent from the Prophet Mohammed, is accorded the title "commander of the faithful" and has a religious TV and radio station named after him, has been busily burnishing Morocco's image as a model Muslim state.
This month, he inaugurated a "religious support programme" that will see the 1,300 imams trained in Rabat since 2006 sent out to instruct preachers lacking formal training at some 50,000 mosques nationwide.
"Their task is to help and guide imams in mosques to preserve the fundamentals of Islam in Morocco, based on the Malikite rite, contrary to takfirism, which is constantly invading the minds of our young people," Islamic Affairs Minister Ahmed Toufiq has said.
The moderate Malikite school of Sunni Islam practised in Morocco -- as in most of North Africa -- is often cited as a key aspect of its religious tolerance, contrasting starkly with radical "takfirist" ideology that brands non-practising Muslims "infidels".
Other features of Morocco's Muslim culture include the important social role played by the Sufi brotherhoods, which Toufiq has encouraged since the king appointed him in 2002, and hundreds of female religious instructors have been trained in recent years alongside the imams.
"Not many other Arab states have sought to this extent to control the religious discourse. The purpose it serves, yes it has a counter-extremism element to it... Of course it has a regime legitimisation purpose too," the International Crisis Group's North Africa director Issandr El Amrani told AFP.
- Regional recognition -
Whatever the reason, the Moroccan model is attracting regional interest, with Saharan-Sahelian countries touched by jihadist violence now soliciting the kingdom's help.
Already 190 imams from Mali are being trained in Rabat, out of 500 in the coming years, under an accord signed when the king visited Bamako for President Ibrahim Boubacar Keita's inauguration in September 2013.
Tunisia, which the king visited last month, has also requested Rabat's help in training its preachers, having suffered a wave of Islamist attacks since the 2011 revolution, with many mosques falling under the influence of extremists.
Signup to our newsletter and follow us on Facebook and Twitter!
At least 2,400 Tunisian jihadists are fighting in Syria, the government said this week.
Libya and Nigeria have also separately asked for religious instruction.
"I think the primary reason Morocco is interested in promoting its brand of Islam... which has the king at its centre, is to export this notion of greater Morocco," says analyst Vish Sakthivel at the Washington Institute.
A priority that has long driven Moroccan diplomacy is winning approval for its claims to Western Sahara, which it annexed in 1975 in a move never recognised internationally.
The pro-independence Polisario Front is hosted and backed by Algeria, the region's security heavyweight, which fought a decade-long civil war against Islamist insurgents in the 1990s and whose rivalry with Morocco prevents the North African neighbours from co-operating.
Sakthivel calls Morocco's religious diplomacy a "symbolic, soft power gesture" to Sahel countries, made in the knowledge that it cannot compete with Algeria militarily.
- Ever-present threat -
Officials insist that Morocco's Islamic model helps to explain why radical ideologies have largely failed to take hold in the kingdom, which has suffered only two major terrorist attacks since 2003, and why other nations are now looking to Rabat.
But while hardline Salafists may enjoy only limited support here -- thousands were jailed in a sweeping crackdown following deadly 2003 bombings in Casablanca -- Morocco is certainly not immune to the religious revival that has swept through the region, nor to the recruitment of jihadists.
This week, security forces in the central city of Fez broke up a jihadist cell which was allegedly sending volunteers to Iraq and Syria, where officials say there are currently more than 1,000 Moroccan combatants.
It was the latest in a wave of busts.
Between 2011 and 2013, 18 such cells were dismantled, while around 200 Moroccans planning to fight in or returning from Syria have been jailed, according to new prison chief Mohamed Salah Tamek.
Last week, Spanish police arrested eight people belonging to a recruitment network in Madrid whose Moroccan ringleader spent three years in Guantanamo Bay.
"We know that many Moroccans, like many other Maghreb states, are going to fight in Iraq or Syria. So it's not that radicalism is completely absent in Morocco. It's there, it's controlled better," says the ICG's Amrani.
"Has Morocco not faced terrorist attacks because it controls the religious discourse to a greater degree in state-run mosques and so on? Or is it because they have more effective security policies, or because it is relatively marginal to all the conflicts in the Middle East?"
"That's not clear."