The foreign ministers of Macedonia and Greece have signed a historic agreement on a modified name for the former Yugoslav republic, a major step in ending a 27-year dispute.

The agreement, signed on June 17 at Lake Prespa along the border separating the countries, paves the way for Macedonia to seek membership in the European Union and NATO.

In the Macedonian capital Skopje, hundreds of protesters took the streets after nightfall to criticize the agreement.

Nationalists in both countries had bitterly opposed the proposed change, which calls for Macedonia to be renamed the Republic of North Macedonia. Parliaments in both countries must still ratify the deal.

The two countries’ prime ministers -- Zoran Zaev of Macedonia and his Greek counterpart, Alexis Tsipras -- attended the signing ceremony in the Greek fishing village of Psarades, along with United Nations and European officials.

"Our peoples want peace...We will be partners and allies," Zaev said.

Tsipras, who survived a no-confidence vote by Greek opponents of the deal, described the agreement as a "brave, historic, and necessary step for our peoples."

"We are here to heal the wounds of time, to open a path for peace, fraternization, and growth for our countries, the Balkans, and Europe," he added.

The deal still needs to be approved by Macedonia's parliament and confirmed in a Macedonian referendum in September, after which Greek lawmakers must ratify it.

Hours after the historic agreement was signed, hundreds of jeering and whistling nationalists took to the streets of Skopje, carrying flags and burning flares as they faced off with riot police.

Some threw chairs, rocks, and other debris at armored vehicles as they tried to push back demonstrators, who chanted "Macedonia, we won't give up the name."



The AFP news agency reported that Greek riot police blocked a few hundred protesters several kilometers away from the ceremony.

The accord was met with strong opposition internally in both countries, which could pose obstacles and delays for its ratification in their national parliaments.

On the eve of the signing ceremony , the Greek opposition party, New Democracy, launched a no-confidence vote in parliament against Tsipras, accusing him of granting too many concessions to Macedonia.

Thousands of Greeks protested outside parliament on the day of the no-confidence motion, calling for Тsipras’s resignation, and police fired tear gas to keep them from entering the building.

Macedonia's President Gjorge Ivanov has pledged to veto the deal if it is ratified by Skopje's parliament.

Macedonian government officials have said that with the deal in hand, they hope to secure a date to begin EU accession talks at a summit later this month and an invitation to join NATO by mid-July.

The name dispute between Skopje and Athens dates back to 1991, when Macedonia peacefully broke away from Yugoslavia, declaring its independence under the name Republic of Macedonia.

Greece had objected to the name Macedonia, fearing territorial claims on its eponymous northern region.

Because of Greek objections, Macedonia was admitted to the UN under a provisional name, the Former Yugoslav Republic of Macedonia.

Greece, an EU and NATO member, has also cited the dispute to veto Macedonia's bid to join the two organizations.

With reporting by Reuters, AFP, dpa, and AP