SKOPJE, North Macedonia (AP) — North Macedonia’s Prime Minister Zoran Zaev formally resigned Wednesday, in a move he had announced after his governing Social Democrat party’s heavy defeat in October’s local elections.

Zaev is set to be replaced by a former deputy finance minister, Dimitar Kovachevski, who was elected as the left-wing party’s new chief on Dec. 13 after Zaev also relinquished the Social Democrats’ leadership.

“The results of the last elections, although local, had a national political weight for the political moment in which the country is,” Zaev said in a letter explaining his resignation.

North Macedonia’s parliament is expected to formally accept Zaev’s resignation on Thursday.

Within the next 10 days, President Stevo Pendarovski must hand the mandate to form a new government to a coalition led by the Social Democrats that controls a majority in the 120-member parliament.

The Social Democrats secured the majority — avoiding an early election — after striking a deal with a small ethnic Albanian party to join the government coalition that will control 64 seats.

After receiving the mandate, Kovachevski, 47, will have 20 days to propose a new government to parliament. His new cabinet is expected to be elected by mid-January.

Zaev served as party leader since 2013 and as prime minister since 2016. He secured North Macedonia’s membership in NATO after ending a decades-long dispute with Greece over the country’s name. But he was unable to advance ambitions to join the European Union, largely due to a historic dispute with another EU neighbor, Bulgaria.

Zaev said Wednesday the deal with Greece “provided lasting peace, security and paved the path for the economic well-being of the people.”

The country’s center-right main opposition party, VMRO-DPMNE, is pressing for an early election, insisting that new cabinet must gain its legitimacy only through a vote.