RABAT (Reuters) - Moroccan Prime Minster Saad Eddine El Othmani said on Saturday he had agreed to form a coalition government with five other parties, breaking nearly six months of post-election deadlock.

FILE PHOTO - Saad Eddine El Othmani of the Islamist Justice and Development Party (PJD) gives his first speech during a meeting of PJD at the Moulay Rachid Complex in Rabat, March 18, 2017. REUTERS/Stringer

Othmani, from the Islamist Justice and Development Party (PJD), was appointed as premier last week by Morocco’s King Mohammed VI. He replaced PJD leader Abdelilah Benkirane, whose efforts to form a government following October elections had been frustrated.

“The next steps will be deciding on government structure and ministerial appointments,” Othmani told reporters, surrounded by the leaders of the five other parties. “We need to move beyond previous obstacles.”

Othmani said the government’s priorities would include reinforcing stability, justice reform, education, rural development and energy.

Before Othmani’s appointment, negotiations had stalled largely over the insistence by the National Rally of Independents (RNI) party on including the Socialist Union of Popular Forces (USFP) in a coalition.

Both parties are among those now expected to form a new government. The other parties are the Popular Movement (MP), the Party of Progress and Socialism (PPS) and the Constitutional Union (UC).

The inclusion of four smaller parties alongside the RNI is seen as weakening the PJD’s position, which analysts said was why Benkirane had resisted such an outcome.

The PJD came to power in 2011, when King Mohammed ceded some powers to ease “Arab Spring” protests. Morocco has since presented itself as a model for economic stability and gradual reform in a region troubled by conflict and political turmoil.

Last year’s election campaign was marked by tensions between the PJD and a resurgent royal establishment, though the PJD retained its position as the largest party, increasing its number of seats to 125.

But Benkirane’s efforts to form a coalition met with opposition from other parties that critics say are too close to the palace. The RNI, which has 37 seats in parliament, is led by Minister of Agriculture and Fisheries Aziz Akhannouch, a close friend of the king.

The deadlock led to concerns that public spending was being put at risk, and delays to economic reform.

After the king’s replacement of Benkirane, a charismatic figure popular with the PJD base, the party’s potential partners quickly expressed optimism that a coalition could be formed.

Under Morocco’s election law no party can win an outright majority in the 395-seat parliament, making coalition governments necessary in a system where the king holds ultimate power.

The Authenticity and Modernity Party (PAM), the second largest in parliament, has said publicly that it intends to remain in opposition.

The conservative Istiqlal party, which was in coalition with the PJD from 2012-2013 before relations soured over economic reform, is also expected to be in opposition.