By Patrick Markey and Aziz El Yaakoubi
MOHAMMEDIA, Morocco (Reuters) - Chanting slogans and jokes in local Darija dialect, Moroccan Prime Minister Abdelilah Benkirane knows how to turn on the populist charm as he campaigns for his Islamist party for an election on Friday they seem set to win.
Five years ago, Benkirane's style helped his Justice and Development Party to a sweeping victory after the king gave up some powers to defuse protests for democratic change.
This time, though, the PJD faces a resurgent royal establishment.
Morocco's second parliamentary election is testing a constitutional monarchy where an elected government works with limited powers in the shadow of a royal palace uneasy at sharing authority with popular Islamists.
After a campaign colored by accusations of royal meddling and creeping Islamist extremism, Benkirane's PJD jostles with main rivals, the Authenticy and Modernity or PAM party, who critics portray as palace loyalists seeking to roll back the PJD's influence.
Benkirane has rallied support playing up the PJD's economic reforms and its popular anti-corruption stance, hoping to extend the moderate Islamist party gains and dismissing PAM's claims he harbors a hidden hardline agenda.
"Some people give you 200, 300 or 500 dirhams for your vote. Don't sell your vote. Vote for someone who will defend you," the Islamist leader told supporters at a rally in the working-class, industrial town of Mohammedia.
Whereas Tunisia, Libya and Egypt toppled long-standing rulers with uprisings five years ago that ushered Islamist parties into power, Morocco's king eased tensions with a combination of limited reforms, higher spending and tougher security.
The North African kingdom presents itself as a model for economic stability and gradual reform in a region where violence and instability is more the norm. Morocco's Islamists have been standard-bearers for co-existence rather than rebellion.
Other groups more harsh in criticizing the king, especially the main opposition, Islamist Justice and Spirituality party, and leftist organizations, boycott elections because the king retains most powers.
But analysts said defeats for Tunisia's Islamist Ennahda party and the overthrow of Egypt's Muslim Brotherhood may tempt Morocco royalists to push back against PJD where the palace once ceded to Islamists as an escape value for tensions in the past.
"The regime used the PJD in 2011 to stifle the protests," said Omar Bendorou, constitutional expert in Rabat University. "Now some think the party could be a threat if it maintains its grip on different offices."
ECONOMIC REFORMS, TESTY TIES
Benkirane's PJD-led coalition has been fiscally sound, pushing reforms in public finances. It cut the budget deficit, overhauled a cumbersome subsidy system and froze public sector jobs -- all praised by international lenders.
Under Morocco's election system, though, no one party can win an outright majority, forcing winners into negotiations to form coalition governments and limiting political influence.
The premier is chosen from the winning party. But the king heads a judiciary council, the security apparatus, and the council of ministers that must approve laws. Some key posts such as the interior ministry are also crown-appointed technocrats.
Just before the election, Benkirane's justice minister accused the technocrat interior minister of trying to control vote preparations, hinting at potential fraud. PJD campaigners also said the ministry was ordering local officials under its control to promote PAM in their neighborhoods.
The interior ministry denied any attempts to influence elections and royal officials say the king keeps his distance from all political parties.
Benkirane himself has been cautious, playing down any friction with the king, if not with PAM, whose former founder is a close friend of the king and now works as a palace advisor.
"I never had a dispute with his majesty, he is my boss. In my Islamic culture, I must obey him by the Koran," Benkirane told Reuters in an interview. "But it does not mean that we always agree from the start."
Ilyass El-Omari, PAM's general secretary, rejected claims his party acts on behalf of the palace. Instead he has promised to review the PJD's economic program, especially a contested pension scheme overhaul.
Still, PAM had already gotten more support in last year's municipal elections, winning more local seats than PJD, even if the Islamists took the capital and major cities like Casablanca and Tangier for the first time since its 2011 victory.
"2011 was a different time," said Geoff Porter at North Africa Risk Consulting. "The PJD is still likely to win, but what it will be able to do is limited by a reinvigorated Makhzen, as the palace and its coterie are known."
(Reporting by Patrick Markey; Editing by Richard Balmforth)