Morocco today announced a government reshuffle on the eve of parliament's reopening that sees the Islamists giving up the key foreign affairs portfolio to a party known for its close ties to the palace.
The new government, which keeps the leader of the moderate Islamist Justice and Development Party Abdelilah Benkirane as prime minister, ends months of haggling and negotiating that at one point looked like it would result in new elections after a coalition partner pulled out over reductions in government subsidies for gasoline and diesel fuel.
The Islamists rode a wave of Arab Spring-inspired, pro-democracy protests to power in 2011, promising political reform and to fight corruption.
Their reformist agenda has had to contend with a fractious coalition and the entrenched powers of the country's hereditary king and court.
Unlike the Muslim Brotherhood in Egypt, however, Morocco's Islamists have shown themselves able to work with the establishment and when the right-wing Istiqlal Party pulled out of the coalition they brought in the National Rally for Independents - a modernist party close to the palace.
Its leader, Salaheddine Mezouar, a former finance minister, was a bitter rival of the Islamists in the election and later was investigated by them for illegally paying himself bonuses.
He will now be Morocco's new foreign minister.
The previous foreign minister differed with the palace on certain issues, including the coup in Egypt, which King Mohammed VI and his allies in the Gulf supported but Morocco's Islamists did not.
The PJD, as the Islamists are known, have similar views on the economy, but having a party close to the palace in the government is expected to tarnish the Islamists' reformist credentials.
"The PJD won the 2011 elections because they offered an alternative to a (pro-palace) alliance of eight parties led by Mezouar, and now he's part of the same government and that will doubtlessly hurt the PJD's credibility," said Ahmed El Bouz, a political analyst.
The Cabinet, which has grown from 31 to 39 positions, includes six women, a major increase over just one in the previous government.
Technocrats also have taken over key positions that once were held by party members. Rachid Belmokhtar is now minister of the economy and Mohammed Hassad is interior minister.