Quebec's provincial government has passed an emergency law restricting demonstrations and shutting some universities as the government seeks to end three months of protests against tuition fee increases. Outraged students reacted by calling it an act of war.

Among the provisions of the law, which passed 68-48 on Friday, is a requirement that police be informed eight hours before a protest and told the route of any demonstration that includes 50 or more people.

Hours after the vote thousands of protesters marched in downtown Montreal to condemn the legislation, which students and supporters say limits their ability to demonstrate their disapproval of the fee hikes. "They pulled the plug instead of trying to develop something constructive through talks, " said participant Felix Siry, 22. "I think this will just make things worse."

Police officers in riot gear and others on horseback watched as the loud and energetic crowd made its way downtown, chanting: "No special law will break us!"

Molotov cocktails were thrown causing police to declare the demonstration illegal. Police used pepper spray and one man was arrested. Some people threw objects at a small group of helmeted police who were forced to retreat but charged back firing teargas.

The crowd was much larger than the hundreds who gathered on Thursday night as the government introduced the bill to quell the most sustained student protests in Canadian history. On Wednesday protesters smashed windows and more than 120 people were arrested. Both police and protesters were injured.

The city of Montreal passed its own ordinance banning protesters wearing masks during demonstrations, levying fines between $500 and $3,000. The city said demonstrators would have to provide details of their itineraries beforehand. Rights groups have protested that it is a restriction on their democratic right to demonstrate.

Officials have said they believe protesters wearing masks have been causing the most trouble. A similar bylaw was under consideration in Quebec City.

"Our cities can no longer become targets," said the Montreal mayor, Gerald Tremblay. "It's time to reclaim our streets, our neighborhoods, our cities."

The Quebec premier, Jean Charest, said the provincial legislation would not roll back the tuition hikes of $254 per year over seven years. Rather, it would temporarily halt the spring semester at schools paralysed by walkouts and bring forward the summer holidays. Classes would resume earlier in August.

The law imposes harsh fines on protesters who block students from attending classes – from $1,000 to $5,000 for a student, $7,000 to $35,000 for a student leader and between $25,000 and $125,000 for unions or student federations if someone is prevented from entering an educational institution.

The Quebec Bar Association said it had serious concerns about fundamental freedoms being abridged and the scale of the restraints was unjustified.

Pauline Marois, leader of the opposition Parti Quebecois, said it was "one of the darkest days of Quebec democracy" and demanded Charest hold elections because of the unpopularity of the law.

Student leaders reacted angrily. Martine Desjardins blamed the government for "letting the conflict deteriorate" and said it was seeking to "drown the conflict in the tribunals". Gabriel Nadeau-Dubois called the law the "murder of the right to demonstrate". He said his group would challenge the law before the courts and called on protesters to take part in a march in great numbers next Tuesday, which will mark the 100th day of protests.

The education minister, Michelle Courchesne, said before the vote that despite the legislation talks would go on and an agreement could still be reached with the students. "Even if there is a special legislation tonight, tomorrow, there can still be an agreement after the law," she said.

She said the law did not prevent students protesting and she remained open to dialogue with them.

The conflict has caused considerable social upheaval in the French-speaking province known for having more contentious protests than elsewhere in Canada and traditionally the country's the lowest tuition rates.

The US consulate in Montreal has warned visitors and US expatriates to be careful because of the demonstrations.