Parties seen as close to Morocco's king have dealt a crushing blow to the long-ruling Islamists in parliamentary elections, preliminary results on Thursday showed.

The Justice and Development Party (PJD), which had headed the governing coalition for a decade, saw its support collapse from 125 seats in the outgoing assembly to just 12, Interior Minister Abdelouafi Laftit told reporters after Wednesday's vote.

Coronavirus concerns have made energetic election rallies few and far between in Morocco Coronavirus concerns have made energetic election rallies few and far between in Morocco Photo: AFP / FADEL SENNA

Following its demise, the PJD leadership, including current chief and outgoing premier Saad-Eddine El Othmani, resigned on Thursday, the party said.

The PJD will now return to its "natural" role in the opposition, a statement said, adding that it will hold an emergency congress as soon as possible.

The PJD was far behind its main rivals, the National Rally of Independents (RNI) and the Authenticity and Modernity Party (PAM), with 97 and 82 seats respectively, and the centre-right Istiqlal party with 78 in the 395-seat assembly.

Most major decisions in Morocco still ultimately flow from King Mohammed VI Most major decisions in Morocco still ultimately flow from King Mohammed VI Photo: Moroccan Royal Palace / Driss BEN MALEK

The Istiqlal (Independence) party, Morocco's oldest, made a remarkable comeback, adding 32 seats.

The RNI, which was a junior member of the governing coalition, is headed by billionaire businessman Aziz Akhannouch, described as close to the palace.

And the main opposition PAM was founded by current royal adviser Fouad Ali El Himma in 2008.

There has been little to set apart Morocco's political parties until the final days of the race There has been little to set apart Morocco's political parties until the final days of the race Photo: AFP / FADEL SENNA

Akhannouch hailed "the popular will for change", calling the results "a victory for democracy".

Composition of the Moroccan parliament ahead of elections on Wednesday September 8 Composition of the Moroccan parliament ahead of elections on Wednesday September 8 Photo: AFP / Kenan AUGEARD

The magnitude of the Islamists' defeat was unexpected. Despite the absence of opinion polls that are banned near election time, the media and analysts had believed the PJD would still come first.

Swept to power in the wake of the 2011 uprisings around the Middle East and North Africa, the PJD had hoped to secure a third term leading a ruling coalition.

King Mohammed VI will name a prime minister from the winning party to govern the nation of 36 million for the next five years, succeeding Othmani.

Most major decisions in Morocco still ultimately flow from King Mohammed VI Most major decisions in Morocco still ultimately flow from King Mohammed VI Photo: Moroccan Royal Palace / Driss BEN MALEK

The final results should be known later on Thursday.

Turnout was 50.35 percent, the interior minister said, higher than the 43 percent in the 2016 legislative polls but lower than the 53 percent during the 2015 local elections.

Changes to the voting system meant it was the first time Morocco's 18 million voters cast ballots in both parliamentary and local elections on the same day, in an effort to boost turnout.

Distribution of seats, based on partial results, in the Moroccan parliament after elections on Wednesday, September 8. Distribution of seats, based on partial results, in the Moroccan parliament after elections on Wednesday, September 8. Photo: AFP / Kenan AUGEARD

Political scientist Ismail Hammoudi said internal PJD policy squabbles after ex-PJD leader Abdelilah Benkirane was ousted as party leader contributed to its defeat.

He said that even the party's religious arm "did not urge its members to vote PJD".

Analyst Mustapha Sehimi said the fact that Othmani's position was seen to be a compromise greatly weakened the Islamists' position.

According to French historian Paul Vermeren, Benkirane's ouster combined with Morocco's normalisation last year of ties with Israel put paid to the PJD, consigning it "to the dustbin of history".

In 2011, the North African kingdom adopted a new constitution devolving many of the monarch's powers to parliament and the government.

But regardless of who holds elected office, major decisions still come from initiatives of King Mohammed VI.

On Wednesday, the Islamists alleged "serious irregularities," including "obscene cash handouts" near polling stations and "confusion" on some electoral rolls, with some voters finding they were not listed.

However, the interior minister said voting took place "under normal circumstances" apart from some isolated incidents.

The short, largely lacklustre election campaign, with no large gatherings because of the coronavirus, had already been marred by accusations of vote buying.

After the 2016 elections, the RNI leader secured critical ministerial jobs for his party, including the economy and finance and industry portfolios.

For the first time since the first elections were held in Morocco in 1960, parties' shares of seats will be calculated based on registered voters, rather than those who actually cast their ballots, in an amendment seen as favouring smaller parties.

Whatever the final outcome, political parties are expected to sign up to a charter for a "new model of development" with a "new generation of reforms and projects" in the coming years, the king has announced.

The plan's major aims include reducing Morocco's wealth gap and doubling per-capita economic output by 2035.