Greece on Friday ratified a landmark accord that changes the name of the neighbouring Former Yugoslav Republic of Macedonia (FYROM), ending a decades-old dispute with its neighbour and opening the way for the ex-Yugoslav republic to join the European Union and NATO.
Prime Minister Alexis Tsipras, who hammered out the deal with his FYROM counterpart last year, secured enough votes to scrape the vote through a deeply-divided parliament on the third day of a debate fraught with emotion, anger and cries of betrayal.
The settlement seeks to end a 28-year old row between Athens and Skopje over the use of the term "Macedonia" by renaming the tiny Balkan state "Republic of North Macedonia" to differentiate from Greece's northern province of Macedonia.
Many Greeks opposing the deal view it as an attempt by their neighbours to hijack ancient Greek civilization and culture.
But Tsipras, a leftist firebrand who swept to power an anti-austerity platform as Greece was deep in financial crisis in 2015, made a point of pursuing a deal.
"This is a historic day for Greece, ending a pending issue which was a burden on our foreign policy," Tsipras told journalists.
Greece's European Union allies, who once shuddered at the anti-austerity rhetoric from the 45-year old premier, welcomed the ratification.
"They had imagination, they took the risk, they were ready to sacrifice their own interests for the greater good," European Council President Donald Tusk tweeted. "Mission impossible accomplished."
The dispute has been on the United Nations agenda for almost three decades, ever since the break-up of former Yugoslavia in 1991 and Greece, swept up by nationalist rage, slapped a short-lived trade embargo on the tiny landlocked state.
Matthew Nimetz, a veteran UN diplomat who worked on the matter for years, called ratification "visionary".
"This historic agreement between two neighbours opens the door to a new relationship between them and ushers in a new era for the consolidation of peace and security in the Balkans," he said in a statement.
The row had stymied FYROM's attempts to join the EU and the NATO military alliance in a region where the two organizations jostle for influence with Russia.
Moscow had taken a dim view of the accord; Greece had taken an unprecedented step in mid 2018 of expelling four Russians, including two with diplomat status, for perceived meddling on the matter.
Opinion polls show that most Greeks oppose the settlement, a fact which may not bode well for Tsipras in an election year. A general election is due by October, and his party is trailing the main opposition, the conservative New Democracy party, by up to 12 points.
The debate in parliament was heated, with voting almost interrupted on Friday when an MP for the neo-Nazi Golden Dawn Party, asked to cast his vote, responded: "No to treason!"
Protests against the deal have at times turned violent this week, and on Thursday evening police fired teargas to disperse crowds outside parliament. Smaller groups of people braved heavy rain on Friday to demonstrate outside parliament.
New Democracy slammed the agreement. "This deal should never have been signed or brought to parliament for ratification," party leader Kyriakos Mitsotakis told parliament.
"It is a national defeat ... a national blunder that is an affront to the truth and history of our country."