Macedonia's president on Wednesday handed the mandate to form a government to left-wing opposition leader Zoran Zaev, an initial step toward ending a political crisis that culminated last month in angry protesters storming parliament.

Zaev has 20 days to seek a coalition partner and form a Cabinet, but said he hoped to complete talks in half that time.

Macedonia has been without an elected government since December, when former Prime Minister Nikola Gruevski's conservative party won elections but fell short of a parliamentary majority to form a government.

President Gjorge Ivanov had earlier refused to give the mandate to Zaev, whose Social-Democrat Alliance party placed second in December's election.

Zaev's pledge to consider enhancing the ethnic Albanian minority's standing threatened to undermine Macedonia's sovereignty, Ivanov said earlier this year.

Wednesday's move was welcomed by the European Union, which Macedonia has long hoped to join.

Giving the mandate to Zaev was "an important step in the process of government formation," European Commissioner Johannes Hahn and EU foreign affairs representative Federica Mogherini said in a joint statement.

"We call on all parliamentary parties to put their divisions aside and work jointly on a common reform agenda, to bring the country back on its Euro-Atlantic integration path," they said. "This is what the people want and deserve."

The German foreign ministry said in a statement that Ivanov's decision "was long overdue and finally reflects the results of the December 2016 elections."

Zaev said he would immediately start coalition talks with three ethnic Albanian parties, the Democratic Union for Integration, Besa and the Alliance for Albanians. One quarter of Macedonia's population is ethnic Albanian.

"All our efforts will be to build a just and legal state, to provide conditions for the quality of life of all citizens in Macedonia with mutual understanding, and to respect the multiethnic character of the country," he said.

In a short statement in the presidential residence, Ivanov said that "the obstacles that we had to give the mandate are now removed."

Macedonia has been roiled by a deep political crisis since early 2015 sparked by a massive wiretapping scandal that left the two main political parties with irreconcilable differences.

The crisis threatened to ignite inter-ethnic conflict. The ethnic Albanian parties demanded that the Albanian language be designated a second official language as a condition for joining a new government. The demand triggered monthly protests throughout the country.

Months of tensions boiled over three weeks ago with the election of an ethnic Albanian lawmaker as parliament speaker. An angry mob stormed the parliament building, leaving more than 100 people injured.

Police have filed criminal charges against about 30 protesters.