OTTAWA — A patchwork of Internet and digital security laws across the country has contributed to Canada’s new No. 3 ranking worldwide as the country of choice for cyber-criminals to set up sites with advanced malware, according to a new study.

But it isn’t just foreign criminals who are setting up shop on Canadian servers to take advantage of Canada’s good reputation in cyberspace: Foreign governments are doing the same to launch corporate espionage attacks on domestic and international companies, according to the 2013 cybercrime report card from Websense Security Labs.

According to the report card, Canada ranks third in the world for hosting malware, ahead of countries such as Germany, Russia and even China, which has faced allegations and accusations that it enables cyber-attacks and sponsors corporate espionage.