Morocco will elect a parliament on Friday for the first time since an Islamist-led government took office following Arab Spring uprisings that toppled leaders across the region.
The Islamist Justice and Development Party (PJD) came to power in 2011 after swelling protests prompted concessions from King Mohammed VI, the scion of a monarchy that has ruled the North African country for 350 years.
A new constitution reduced some, though not all, of the king's near-absolute powers. Prime Minister Abdelilah Benkirane's PJD says a second term would allow it to continue its limited economic and social reforms.
Heading a coalition that includes communists, liberals and conservatives, it retains considerable support among the urban middle classes that have largely abandoned the left in favour of Islamist parties.
But it has been weakened by rising unemployment and what critics say is a failure to deal with corruption.
The party has faced a string of scandals within its ranks including a major drugs bust, a dodgy land-grab deal and the suspension of two vice presidents found in a "sexual position" on a beach.
It also faces a resurgent liberal opposition Authenticity and Modernity Party (PAM), formed in 2008 by a close adviser to the king.
The PAM has poured enormous resources into a campaign criticising the government's record as "catastrophic" and pledging to roll back the "Islamisation" of society.
It pitches itself as the defender of women's rights and liberal social mores, and aims to bring more women into parliament, where they hold just 67 out of 395 seats.
The PJD accuses its rival of being the party of the palace, part of a shadowy "parallel state" controlling political life.
If it holds on to power, the PJD will remain an essential part of Moroccan politics, "despite the feelings it rouses at the palace and among the globalised bourgeoisie," said Pierre Vermeren, a historian of the Maghreb region.
A victorious PJD would try to take the opportunity to gain more space from the monarchy for joint decision-making, he said.
But the decisive clout in Morocco remains in the hands of King Mohammed VI -- regardless of who is in government.
"The king is de facto the exclusive decision maker on a series of long-term and strategic matters," including foreign policy and big infrastructure projects, according to an analysis from the Carnegie Endowment for International Peace, a Washington-based think tank.
At the same time the monarchy can present the successful inclusion of an Islamist party "as a sign of the ongoing process of democratisation following the adoption of the 2011 constitutional amendments," it added.
Previously the monarch could choose his prime minister, but since the consitutional changes he must appoint someone from the party that wins the most seats in parliament.
Friday's poll also marks the return of Salafists, followers of an ultra-conservative brand of Sunni Islam, to the political arena.
There are only a few dozen Salafists among the 7,000 candidates in Friday's poll, but their re-emergence is a notable shift in a country where they were once pariahs.
They include Abdelwahab Rafiki, also known as Abou Hafs, a former preacher who was sentenced to 30 years in prison after jihadist attacks in Casablanca in 2003 that left 45 people dead.
He was pardoned in 2012 and is running for Istiqlal, a nationalist party.
Rafiki is not alone. The Casablanca bombings prompted authorities to arrest some 8,000 people, many of them Salafists.
But like him, many were pardoned following the turmoil of 2011, and have since gained a foothold in Moroccan politics.
Moroccan Salafists were among the thousands who headed to Afghanistan in the 1990s to fight the Soviet Union. Today, many have renounced violence and declared allegiance to King Mohammed VI.
"It is the classic old policy of the palace, which after sanctioning deviants, reintegrates them," Vermeren said.
*This story was edited by Ahram Online.