Greece’s parliament narrowly passed a bill early on Saturday that will allow foreign private universities to set up branches in the country, bucking weeks of protests by students who say the move will devalue degrees from public universities.

The legislation was approved by 159 lawmakers in the 300-seat parliament.

Prime Minister Kyriakos Mitsotakis said it will help reverse an exodus of tens of thousands of Greek students to universities abroad, a drag on an economy still recovering from a decade-long financial crisis.

The bill will also help align Greece with the rest of the European Union and boost competition in higher education, he said in a speech to lawmakers.

Students have been protesting peacefully for weeks against the bill. On Friday afternoon thousands of students rallied outside parliament holding banners reading “no to private universities”. A group of protesters who peeled off from the main group threw petrol bombs at police, who responded with teargas.

“We are scared that … if we do manage to graduate we’ll never be able to get a job anywhere,” said Stratos Katselis, 25. “No young person today can make any kind of plan for the future. All we see are dead ends.”

The university bill is part of a government reform agenda that also includes a same sex marriage law that was passed last month.

Greece spends 3%-4% of its annual economic output on education, below the EU average. Mitsotakis, who won a second term in June last year, said the bill stipulated increased funding for state universities.