Japan’s government has been accused of trying to stifle the public’s right to know after enacting a controversial state secrets law that critics say marks a return to the days of Japanese militarism.

Under the new law, which was passed a year ago, civil servants who leak state secrets face up to 10 years in prison, while journalists who encourage whistleblowers to leak could get up to five years.

The prime minister, Shinzo Abe, said the law would be applied only to intelligence leaks that threatened national security, diplomacy, public safety and anti-terrorism measures.

Abe has said that the law would not criminalise journalism. “If the law prevents films from being made, or weakens freedom of the press, I’ll resign,” he said.

He and other conservatives insist that Japan needed to tighten control of state secrets so that it can safely share intelligence with its closest ally, the US, amid growing concern over China’s military buildup in the region and North Korea’s nuclear weapons programme.

But critics say the law marks a return to the days of prewar and wartime Japanese militarism, when the state used the Peace Preservation Act to arrest and imprison political opponents. They claim it will be open to abuse by officials who want to conceal information that may embarrass the government, adding that the law is vague on what constitutes a state secret.

“This has made it so that even if you don’t illegally get or leak secrets, if you solicit or conspire to get secrets it’s possible to be tried for a crime,” said Yoichi Eto of the Japan Federation of Bar Associations.

“That’s the sort of system it is. So everyone’s desire to know and find out things will slowly wither away and that desire to actually know important things about national politics will fade.”

Reporters Without Borders called the new law “an unprecedented threat to freedom of information”.

Abe’s approval ratings fell below 50% for the first time after the law was passed at the end of last year. Polls showed that almost two-thirds of voters thought the change was being rushed through parliament with little public consultation.

On Wednesday, several hundred people demonstrated outside Abe’s office. “This terrible law must be revoked, but at least if we keep on protesting the government won’t be able to do whatever it likes,” one protester, Yumi Nakagomi, told Reuters.

The deputy chief cabinet secretary, Hiroshige Seko, insisted the law would not diminish the public’s right to know. “By applying the law practically and properly, explaining carefully how it is being applied, and reporting to parliament and making public how it is being enforced, the government plans to show clearly that the people’s right to know will not be infringed on,” he told reporters.