Japan will punish people who create or wilfully spread computer viruses with fines and prison terms of up to three years under a new law enacted by parliament.
Under the law, police can seize email communication logs of suspects from Internet service providers, among other information.
The action, which has met with opposition from privacy and free speech advocates, brings Japan a step closer to concluding the Convention on Cybercrime, a Europe-led effort.
The convention is the first international treaty to combat crimes committed via the Internet and other computer networks. Japan has signed the treaty but must pass relevant domestic laws to conclude it.
Under Japan's new law, people who create or distribute a computer virus with no justifiable reason face prison terms up to three years or fines up to 500,000 yen (6,200 dollars).
Those who deliberately store a computer virus face up to two years in prison or fines up to 300,000 yen.
Japanese police agencies had long pushed for such a law, but past bills failed amid strong criticism from privacy and freedom-of-speech advocates who have warned of excessive police powers.
The text of the law says that "in view of the realities of cyber crime associated with the advancement of information processing ... it is necessary to develop the necessary regulations".
Because of concerns the law could violate the privacy of communications guaranteed under the Japanese constitution, it includes a resolution that urges authorities to apply the law appropriately.
Explore further: Twitter blocks two accounts on its Turkish network