Greece and Macedonia signed a historic agreement on Sunday to rename Macedonia the Republic of Northern Macedonia, ending a 27-year-old dispute between the two countries.

Macedonia is officially called the Former Yugoslav Republic of Macedonia, but Macedonia is also a region in Northern Greece. In February, at least 1.4 lakh Greeks gathered in Athens to protest against its neighbouring country using “Macedonia” in its name.

Greek Foreign Minister Nikos Kotzias and his Macedonian counterpart Nikola Dimitrov signed the historic accord on Sunday in the fishing village of Psarades in Greece.

“This is a brave, historic and necessary step for our peoples,” said Greek Prime Minister Alexis Tsipras after the accord was signed. “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 according to CNN.

The agreement comes a day after Tsipras survived a no-confidence vote over his handling of the dispute.

Macedonian Prime Minister Zoran Zaev asked his critics “to step out of the past and look to the future”. “Our peoples want peace … We will be partners and allies,” The Guardian quoted Zaev as saying. “We are proud of today’s agreement … May we stay as forever united as we are on this day.”

The accord still has to be approved by both countries’ parliaments and pass in a referendum in Macedonia. The agreement will also enable Macedonia to start proceedings and eventually join the European Union and the North Atlantic Treaty Organization, reported Al Jazeera.

The dispute over the name began in 1991, after Macedonia gained independence from Yugoslavia. While most Greeks call Macedonia Skopje – the name of its Capital – officials in Skopje maintain that their country has been known as Macedonia for years. A majority of Greeks feel that the use of the name implies territorial claims on its own province.