The government of Prime Minister Alexis Tsipras of Greece survived a no-confidence vote in Parliament on Saturday called over a landmark agreement to change the name of Macedonia and end a decades-old dispute with Greece.

But the government’s parliamentary majority was reduced to three after a lawmaker, Dimitris Kammenos of the nationalist Independent Greeks, the government’s junior coalition partner, voted in favor. He was kicked out of the party immediately.

Lawmakers in the 300-member Hellenic Parliament voted 153 to 127 against the motion brought by Kyriakos Mitsotakis, the leader of the conservative main opposition New Democracy party, over the deal to rename the former Yugoslav republic the Republic of North Macedonia. The agreement also calls for Athens to drop its opposition to the renamed country’s joining NATO and the European Union.

Thousands of protesters rallied outside Parliament during the debate, waving Greek flags and chanting anti-government slogans. Scuffles broke out, with riot police firing tear gas to stop protesters from breaching police lines.