Several Canadian government websites and servers were taken down in a cyberattack on Wednesday, the government said, with the hacking group Anonymous taking responsibility in what it said was retaliation for a new anti-terrorism law passed by Canada's lawmakers.

The general website for government services, canada.ca, as well as the site of Canada's spy agency, the Canadian Security Intelligence Service (CSIS), were among those affected.

Tony Clement, the Cabinet minister responsible for the Treasury Board, confirmed on his Twitter account the cyberattacks on government websites. The government said the attack also affected email, Internet access and information technology assets, but that it was working to restore the services.

In a video posted on YouTube, the informal online activist group known as Anonymous said the anti-terrorism law, recently passed by the Canadian Senate, violated human rights and targeted people who disagree with the government.

Bill C-51, or the Anti-terrorism Act, 2015, would broaden the mandate of CSIS, giving the agency new powers to disrupt perceived security threats. The legislation, once enacted by the government, would also make it easier for federal agencies to increase surveillance and share information about individuals.

Public Safety Minister Steven Blaney denounced the cyberattacks, telling reporters that there were many other democratic ways for Canadians to express their views. He also said the government was implementing efforts to improve its cybersecurity.