SKOPJE (Reuters) - Macedonia's parliament approved a key law allowing for the wider use of the Albanian language on Wednesday despite efforts by opposition Macedonian nationalists to thwart the vote, but the president again refused to sign it.

The law is a key part of a coalition deal between the ruling Social Democrats and their junior coalition partners -- parties representing ethnic Albanians in the small ex-Yugoslav republic.

Parliament had already approved the law once but President Gjorge Ivanov, a close ally of the nationalist VMRO-DPMNE party, had refused to sign it, saying it was unconstitutional. This forced the assembly to hold a second vote.

But on Wednesday evening in a video address distributed to media, Ivanov said he would not sign a decree that would allow the implementation of the law.

"The law on languages is unjust and repressive, and it favourites only one language. That kind of law will deepen inter ethnic tensions and represents a threat for the inter ethnic life," Ivanov said.

"I will not sign the decree to proclaim a law that has been adopted in such a manner, a law that misuses the European flag, a law that had no debate on the amendments, a law voted outside all procedures and a law that is unconstitutional," Ivanov said.

It remains unclear how and if the law will take effect without Ivanov's signature.

Macedonian nationalists are opposed to granting further rights to the large ethnic Albanian minority. An insurgency among the ethnic Albanians almost tore the country apart in 2001 before it was ended by an internationally brokered peace deal.

During Wednesday's session several hundred people protested in front of the parliament building.

Inside, as parliamentary speaker Talat Xhaferi was about to call the vote, former prime minister and ex VMRO-DPMNE leader Nikola Gruevski, along with several other lawmakers, approached him, pulled away his microphone and spilled water on his desk.

Eventually, with the help of security guards, the voting procedure went ahead and 64 deputies in the 120-member assembly backed the law.

VMRO-DPMNE, the single biggest party in parliament and which led the country until 2016, filed 35 amendments in an attempt to undermine the vote, but they were all rejected.

Macedonia was thrown into political turmoil in 2015 when opposition parties accused Gruevski, then prime minister, and his counter-intelligence chief of orchestrating the wiretapping of more than 20,000 people.

The crisis came to a head last April when nationalists stormed the parliament building and assaulted Prime Minister Zoran Zaev in a protest against the election of Xhaferi, an ethnic Albanian, as parliament speaker.

Macedonia has made little progress towards European Union and NATO membership due to a long-running dispute with neighbouring Greece, which says Macedonia's name represents a territorial claim to a Greek province with the same name.

Zaev has pledged to resolve the name issue and to accelerate the country's accession to NATO and the EU.