MPs in Greece have narrowly voted to ratify an agreement with its northern neighbour state Macedonia that will see the latter formally change its name.

In return for rebranding itself the “Republic of North Macedonia”, the country will now be able to pursue its application to join Nato and the EU without opposition from Athens as relations between the two states return to normal.

The deal passed with 153 votes in the 300-member Greek parliament, two more than needed. It had faced heated opposition and cost prime minister Alexis Tsipras his parliamentary majority after a right-wing partner in the governing coalition quit in protest.

The vote came after three days of acrimonious parliamentary debate and numerous street protests, some of which turned violent.

Scores of protesters who braved torrential rain and driving wind outside parliament chanted “traitors” as the legislators voted inside.

In photos: Protests in Greece against Macedonia name change Show all 20 1 /20 In photos: Protests in Greece against Macedonia name change In photos: Protests in Greece against Macedonia name change Protesters clash with police near the Greek Parliament during a demonstration against an agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia AFP/Getty In photos: Protests in Greece against Macedonia name change The proposal faced resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests AFP/Getty In photos: Protests in Greece against Macedonia name change Greek anti-riot police officers arrest a protestor AFP/Getty In photos: Protests in Greece against Macedonia name change Protesters clash with riot police AFP/Getty In photos: Protests in Greece against Macedonia name change rotesters take part in a demonstration near the Greek Parliament AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - A protester with a Greek flag clashes with riot police during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia, on January 20, 2019 in Athens. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Aris MESSINIS / AFP)ARIS MESSINIS/AFP/Getty Images ARIS MESSINIS AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clashes with police during demonstration against an agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia, on January 20, 2019, in Athens. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty= In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with riot police near the Greek Parliament in Athens on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Aris MESSINIS / AFP)ARIS MESSINIS/AFP/Getty Images ARIS MESSINIS AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with riot police near the Greek Parliament in Athens on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Aris MESSINIS / AFP)ARIS MESSINIS/AFP/Getty Images ARIS MESSINIS AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - A man holds a hammer as protesters clash with riot police in front of the Greek Parliament in Athens on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with riot police in front of the Greek Parliament in Athens on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Aris MESSINIS / AFP)ARIS MESSINIS/AFP/Getty Images ARIS MESSINIS AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with riot police in front of the Greek Parliament in Athens on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Aris MESSINIS / AFP)ARIS MESSINIS/AFP/Getty Images ARIS MESSINIS AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with police in front of the Greek parliament at a demonstration against an agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia, on January 20, 2019, in Athens. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with police near the Greek Parliament during a demonstration against an agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia, on January 20, 2019, in Athens. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - A protester throws back a tear gas carnister at riot police in Athens, on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters clash with riot police in Athens on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - A protester holds a police in Athens, on January 20, 2019 during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests. (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - A man kneels from tear gas surrounded by riot police during a demonstration against the agreement with Skopje to rename neighbouring country Macedonia as the Republic of North Macedonia, on January 20, 2019 in Athens. - The proposal faces resistance in Greece because of what critics see as the implied claims to Greek land and cultural heritage. For most Greeks, Macedonia is the name of their history-rich northern province made famous by Alexander the Great's conquests(Photo by Louisa GOULIAMAKI / AFP) (Photo by Louisa GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - Protesters demonstrate outside the Greek Parliament against an agreement to rename Greece's neighbour as the Republic of North Macedonia, in Athens on January 24, 2019. - Greece's parliament, on January 24, postponed for several hours a historic vote on a deal to change the name of neighbouring former Yugoslav Republic as the Republic of North Macedonia and end one of the world's longest diplomatic disputes. (Photo by LOUISA GOULIAMAKI / AFP)LOUISA GOULIAMAKI/AFP/Getty Images LOUISA GOULIAMAKI AFP/Getty In photos: Protests in Greece against Macedonia name change TOPSHOT - A protester throws a tear gas back to riot police during a demonstration against an agreement to rename Greece's neighbour as the Republic of North Macedonia, in Athens on January 24, 2019. - Greece's parliament, on January 24, postponed for several hours a historic vote on a deal to change the name of neighbouring former Yugoslav Republic as the Republic of North Macedonia and end one of the world's longest diplomatic disputes. (Photo by ARIS MESSINIS / AFP)ARIS MESSINIS/AFP/Getty Images ARIS MESSINIS AFP/Getty

More than 150 people were detained for questioning following confrontations at demonstrations against the deal in Athens and two towns in northern Greece. Most were released without change.

Macedonia fulfilled its end of the bargain regarding the motion on 11 January, when all 81 members present for its own parliamentary vote on the question backed the constitutional amendments. The remaining 39 opposition politicians in the 120-seat house stayed away in protest.

Greeks, particularly right-wing nationalist politicians, have long argued that only the northern Greek region of Macedonia, site of the ancient kingdom of Macedon, should be entitled to use the name and not the separate Slavic country to its north, which has been officially known as the Former Yugoslav Republic of Macedonia since the collapse of the Soviet Union in 1991.

The debate has raged for 27 years and the signing of an initial agreement to consider the change on 12 June 2018 was hailed as “an appointment with history” by Mr Tsipras and by Macedonia prime minister Zoran Zaev as a chance for the pair to reset relations and become “partners and allies”.

The men also expressed hope their example would inspire other Balkan states to resolve their own post-Cold War regional disputes.

Macedonians subsequently voted 91 per cent in favour of making the name-change in a referendum on 30 September, with Mr Zaev saying the vote sent out “a crystal-clear message” even though only 37 per cent of registered voters turned out at the ballot box.

“The people made a great choice and said ‘yes’ to our future. It is time for lawmakers to follow the voice of the people and to provide support,” the prime minister said.

Local resistance to the measure had been fierce, with many fearing it represents the first attempt by Greece to claim its territory and resent their country’s access to the security of the international community being dictated by a foreign power.

Rioting took place on the streets of the Greek city of Thessaloniki prior to the referendum, forcing police to use tear gas to disperse thousands of masked protestors demonstrating as Mr Tsipras arrived in town to make an address on his country’s economic prospects.

Support free-thinking journalism and attend Independent events

Macedonia made its first concessionary moves over the issue last January by pledging to rename Skopje’s Alexander the Great airport, the name a further annoyance to Greeks concerned about cultural appropriation and claims being made on its heroes of antiquity.