Japan's ruling coalition passed a controversial law on Thursday, targeting conspiracies to commit "terrorism" and other serious crimes.

Thousands of people have protested in Tokyo against the law over the past two days.

More than 5,000 people gathered outside the Japanese parliament on Wednesday to demonstrate against the law and protests are set to continue into Thursday night.

The government says the bill is part of the international joint effort against crime ahead of the 2020 Olympic Games.

After the parliamentary vote on Thursday, Prime Minister Shinzo Abe told reporters the law seeks to protect Japanese citizens and is part of the Convention on Transnational Organized Crime, "to prevent terrorism before it happens".

But critics say it's an abuse of power and an unconstitutional attack on freedom of expression.

"This legislation is the perfect example of how the government is using counterterrorism as an excuse for mass-surveilance of ordinary citizens and activists, trying to re-militarise the country and crackdown on dissidents," Tokyo resident, Lisa Torio, told Al Jazeera.

OPINION: Japan's new Defence White Paper - Turbulence ahead

Despite resistance from the opposition bloc, the bill was approved after more than 17 hours of debate. The bill writes 277 new crimes into law.

But the opposition says many are petty crimes, targeting regular citizens, such as copyright violations or even stealing lumber from forests.

New law allows Japan’s Emperor Akihito to abdicate

In May, the UN Special Rapporteur for privacy rights, Joseph Cannataci, warned that: "If adopted into law [this bill] may lead to undue restrictions to the rights to privacy and to freedom of expression."

Additionally, "[it] would permit the application of laws for crimes which appear to be totally unrelated with the scope of organised crime and terrorism", Cannataci said in an open letter to Japan's Prime Minister.

In an interview with Kyodo News earlier this month, US whistleblower Edward Snowden called the bill "the beginning of a new wave of mass-surveillance in Japan".

"This is a normalisation of a surveillance culture, that has not previously existed in Japan in public", he said.

The bill was revised several times over the years as earlier versions met with fierce resistance and did not make it through parliament.

Japanese citizens have been protesting on and off since December, when the bill was first proposed. Online movements are calling for the protests to continue, although polls show that public's opinion regarding the bill is divided.

Source: Al Jazeera and news agencies