Canadian lawmakers weren’t exactly in the Halloween spirit when they approved a new bill on Wednesday. The legislation makes it illegal to wear masks during riots and protests. Guilty parties could face up to 10 years in prison.

Bill C-309 passed with a vote of 153 to 126 in the Canadian Parliament. It will now move on to the Senate.

If it becomes law, mask-wearers at riots face up to 10 years in jail. Those busted wearing a disguise at an unlawful protest could be sentenced to up to five years in the big house.

The sanctions would not apply to those taking part in peaceful demonstrations or protests.

Parliamentarian Blake Richards, who sponsored the bill, says the measure is aimed at targeting the “growing threat” of vandalism and violence.

Lawmakers are particularly targeting the Blak Bloc anarchist group, whose members dress in black and hide their faces with glasses, scarves, and hoods. The group engaged in violence during the Quebec student protests earlier this year.

MPs supporting the bill are unsurprisingly thrilled that it passed through parliament.

"To have the support of the house, to get the bill through, obviously we're on the way to where we want to be, which is having the opportunity to better protect public safety," Richards said in a statement.

The legislation was brought forward as a response to the 2011 Stanley Cup riots in Vancouver.

Police documented 15,000 criminal acts during the riots, but were able to make very few charges because they couldn’t identify the people involved.

However, not everyone is so quick to support the bill. Some say it could be the beginning of a slippery slope.

"I don't think people understand the implications that it has — when does wearing a toque low on your face become a mask? Are we going to ban people from appearing in a protest because they are wearing a burqa? Are we going to say that on a cold day that people can't wear a mask?" Interim Liberal Leader Bob Rae said in a statement.

Liberal MP Carolyn Bennett said the bill could have unintended consequences by encouraging pre-emptive arrests, which may lead to lawsuits by demonstrators who feel they were unlawfully detained.

Other opposition members say the bill is unnecessary because it merely criminalizes what is already criminal.

It is already illegal to wear a disguise while committing an offense, including rioting. However, unlawful assemblies do not fall under the current law.

The bill is controversial as it makes it difficult to draw a line between a peaceful demonstration and unlawful gathering, Michael Forian, reporter at CJAD Radio, told RT.

“What this law basically does is that it will criminalize people who are in protest if the police of that city deem the protest to be an unlawful assembly,” he argues.“Let’s look at Montreal for example and any major city in Quebec, where if you are 50 people or more in a peaceful protest, a non-violent protest – that could be deemed an unlawful assembly if you have not presented your itinerary, and the directions of your protest routes to the police force of the municipality on Quebec.”