The ruling Islamic PJD party has suffered a crushing defeat in Wednesday's regional and national polls with the liberal RNI and PAM parties taking close to half of parliamentary seats.
The Justice and Development party (PJD) had been a collation partner in the past two governments, but it won just 13 of the 395 seats contested in Wednesday's election, a sea change from previous polls.
The National Rally of Independents (RNI) took 102, the Authenticity and Modernity Party (PAM) took 86 and the conservative Istiqlal party took 81 seats. PJD trailed in 8th position.
The latest tallies were confirmed by the interior ministry on Thursday.
Fifty percent of registered voters turned out for Wednesday's vote, five percent more than in 2016.
The National Rally of Independents (RNI) had performed poorly in the 2016 election, winning only 37 seats against Islamist PJD, which took 125.
But RNI ministers in the last government held the finance, trade, agriculture and tourism portfolios.
PJD, Morocco's largest party, issued a statement on Wednesday accusing the opposition of vote buying, but did not specify which party.
The vote confirmed that Moroccans are disappointed by PJD's lack of results. The conservative Islamist party had opposed the promotion of the French language in education and allowing cannabis for medical use.
As a constitutional monarchy, the King of Morocco, Mohammed VI, picks the prime minister from the party that won the most seats, who then forms a cabinet, which the king must approve.
The king is also involved in the selection of key portfolios, including foreign affairs, defense and ministry of the interior.
A change in the voting rules has made it harder for one party to take most of the seats, so RNI will need to form a coalition.
It will also be tasked by the palace to implement a new economic development model.