(CNN) — Greece and Macedonia signed an historic agreement Sunday to rename the latter the Republic of North Macedonia, possibly putting end to a dispute that has soured relations between the two countries for decades.
"This is a brave, historic and necessary step for our peoples," said Greek Prime Minister Alexis Tsipras, when signing the accord in the lakeside fishing village of Psarades on the border between the nations.
"We are here to heal the wounds of time, to open a path for peace, brotherhood and growth for our countries, the Balkans and Europe," he said.
The accord still has to be approved by both countries' parliaments and pass in a referendum in Macedonia.
Senior EU officials were also present at the signing ceremony.
"Its a very good day for the two countries, and it is also a good day for the EU, Europe and the Balkans," said the European Union's Foreign Affairs Commissioner Federica Mogherini. "We are there thanks to the dedication, commitment, courage, leadership and hope that both Prime Ministers have put into this process," she said.
When Macedonia peacefully gained independence from Yugoslavia in 1991, Greece balked at the name, saying it implied territorial ambitions toward Greece.
Greece also has a region called Macedonia. It's in the northern, mountainous part of the country and includes Greece's second-largest city, Thessaloniki, and ancient Philippi, a UNESCO World Heritage Site.
The United Nations has been calling it the Former Yugoslav Republic of Macedonia. (You'll see the acronym FYROM on Google Maps.) In addition to causing confusion, the similar names have been a stumbling block for the nation of Macedonia to join the European Union and NATO because of Greece's objections.
NATO said the agreement will "set Skopje on its path to NATO membership" and praised the two leaders for their willingness to "solve a dispute which has affected the region for too long."
This is the Archaeological Museum of Macedonia, which is in the capital, Skopje.
"Our two countries should step out of the past and look to the future," said Macedonia Prime Minister Zoran Zaev at Sunday's signing. "Our peoples want peace ... we will be partners and allies."
It was the election of Zaev in 2017, an economist, that proved crucial to the agreement which could still unravel however.
The Macedonian parliament is scheduled to start debating the agreement next week, amid concern President Gjorge Ivanov will exercise a one-time veto option to block the deal that the nationalist opposition has called a "capitulation".
Under the terms of the deal, the Macedonian constitution must also be revised by the end of the year, before Greece's parliament is called to ratify it.
Police fired teargas on hundreds of people who gathered in front of the Greek parliament on Saturday to protest against the agreement.
They argue that by officially recognizing a Macedonian language and nationality, it is almost certain that the country will be called Macedonia by the broader world, instead of North Macedonia.
Officials in Athens insist that the deal will help stabilize the historically volatile Balkan region, permitting Greece to focus on other regional challenges, Turkey among them.
There were more protests on Sunday when riot police beat back a crowd of around 5,000 Greeks protesting in a village roughly 10 miles from where the agreement was signed.