Saadedine Othmani has been busy getting out the vote in his Casablanca constituency. The leader of the Justice and Development party is offering something new for voters in today's parliamentary elections: "Islamic values", with a commitment to tackle corruption and fight for social justice. The party's logo, an oil lamp, is to light the way to a better future.

Islamist parties don't come any tamer than Justice and Development, known as the PJD. It does not seek to impose sharia law or restore the caliphate and - crucially - accepts King Mohammed VI as "commander of the faithful", the ancient title that makes him both a religious and secular ruler.

Despite widespread voter apathy, an election that is expected to be freer and fairer than anywhere else in the region is being closely watched - in the Arab world and the west - as an example of how moderate Islamists can take part in democratic politics. Elsewhere they are banned outright, marginalised, or, like Egypt's powerful Muslim Brotherhood, face constant state repression.

No one fears a rerun of the bloody civil war next door in Algeria where the military cancelled elections after the first round in December 1991 to stop a more radical Islamist party taking power. Mr Othmani's cautious Islamist monarchists look like a safe bet, not even challenging the royal prerogative of appointing the prime minister.

"Morocco has a parliament, a government and a pretty vibrant civil society," said Ali Ammar, owner of the hard-hitting Le Journal weekly. "But all power still resides with the royal palace."

Political stability has paid off. Foreign investment is flowing in. This week's big news is that Renault-Nissan is building a huge plant in Tangier. Offshore call centres for French and Spanish companies are mushrooming. Tourism is booming, with direct low-cost flights from Europe.

But Morocco's dark side is impossible to ignore. Illiteracy rates are at 43%, with real unemployment at perhaps 20% - the reason so many young people are desperate to do menial jobs abroad. The poor worry about price rises and a bad harvest, while the middle classes focus on the booming stock market.

Usual suspects

Sidi Moumen is an ugly reminder that Casablanca is where the word bidonville (shantytown) was coined in colonial times. Youths sit listlessly outside concrete hovels, with satellite TV dishes on every corrugated iron roof and goats picking at piles of stinking rubbish.

It was from here that a dozen local men set out in May 2003 to carry out coordinated suicide bombings that left 45 people dead across the city. Other Moroccan Salafist bombers went on to hit Madrid a year later. The celluloid charm of Rick's Café-Americain bar is light years away. Casablanca's "usual suspects" are jihadi fanatics these days.

Straightforward repression was one answer to what many call "Morocco's 9/11", but the king drew other conclusions. "The palace wanted to ensure there was a united front of Islamists against the extremists," said the political scientist Mohammed Darif. "That's the long game."

Even the semi-legal Justice and Charity movement, which is boycotting the polls, will, he believes, eventually be brought on side.

"Moderation is always a barrier to extremism," Mr Othmani told the Guardian. "It's true of the French centre-right vis a vis the National Front, it's true of the left and it's the same with Islamists too."

At a rally on Wednesday in a nondescript Casablanca suburb, the psychologist made a pledge to supporters: "We will either form part of a strong government, or we will be a strong opposition".

During the rally, Mr Othmani promised equality for women, transparency, and a focus on jobs, health and schools - to applause from the headscarved mothers segregated from men in the modest crowd. Teenage stewards handed out leaflets and national flags, while a supposedly secret policeman in a jellaba took careful notes.

"The PJD candidates are professional people - doctors and engineers - with brains," said an admiring Said Salah, a mechanic and father of five. "They are not extremists. And they are not buying their votes like the others."

No other party approaches it for organisation, credibility or popular appeal. It would ban the sale of alcohol only in public places, compares itself to Turkey's ruling AK party (the name means the same) and encourages parallels with Europe's Christian Democrats.

Polls suggest the PJD will win 60-70 seats in the 325-member parliament and could be the biggest single party. It cannot rule alone: Moroccan governments are always coalitions, with 33 parties fracturing the vote and bolstering the king's ability to fix things his way.

Diplomats and analysts say the king is playing a double game - seeking to co-opt and house-train the PJD as he has done with other parties, while sending out the subliminal message that the party stands at the top of a slippery slope that leads to terrorism. Mohamed el-Yazghi of the Socialist Union of Popular Forces is blunt: "Voters have to choose between those who seek to push Morocco into a dark tunnel of obscurantism, hatred and war of religious sects and those who defend democracy and progress."

Ordinary Moroccans seem little troubled by the Islamist question. And most seem underwhelmed by the election. "I will vote because it is my duty," said Nakhla, a sound technician.

But Ahmed, a fortysomething textile engineer, was scathing. "It's a waste of time. All politicians - Islamists, Socialists, whatever, just want to line their pockets. These elections are a facade. The king wants to pretend to the Europeans and the Americans that he is a democrat. Nothing will change."

Optimists hope the elections mark the start of a process that could encourage other Arab leaders to open up their authoritarian systems to Islamist reformers. "Everything is so gloomy in the Arab world; Morocco is the only place where there's a little bit of light," said Michael Willis, a Maghreb expert at Oxford University.

"Whatever happens here," said Ali Ammar, "the result is going be interesting and important - for Morocco and elsewhere in this part of the world."

Vital statistics

Morocco's population: 33.7m

Percentage of the population living on less than $1 a day: 2

GDP per capita, in dollars, compared with $8,800 for Tunisia: 4,600

Percentage of people who have a mobile phone: 52

Sources: UN/CIA World Factbook

Backstory

King Mohammed VI, 44, has been ruling over 33 million Moroccans since succeeding his father in 1999. M6, as he is cheekily known, has cultivated the image of a modernising reformer who loves the poor. In reality this uncharismatic "executive monarch" utterly dominates the political system. The wealth gap has widened; women's rights have improved but press harassment has worsened. Morocco, with a rich Berber as well as Arab Muslim culture and a tradition of religious tolerance, is in the far west of the Arab world and is detached in many ways. It remains at odds with Algeria over its support for Polisario guerrillas seeking independence for the Moroccan-controlled Western Sahara. Rabat is a loyal ally of the US in its "war on terror". It generally looks north to Europe, not south to Africa.