Attorney-General Mark Dreyfus has ordered leaking charges against lawyer Bernard Collaery to be dropped.

Mr Collaery had been facing charges for four years after he was accused of leaking classified information about an alleged Australian spying operation in East Timor.

The classified information related to an alleged bugging operation of the East Timor prime minister’s office by Australian officials in 2004.

Mr Collaery had been facing five charges related to breaching the Intelligence Services Act.

Mr Dreyfus told a media conference in Sydney on Thursday he had “determined this prosecution should end”, citing the need to protect Australia’s national interest including relationships with close neighbours.

“In taking this decision I have had careful regard to our national security, our national interest and the proper administration of justice,” he said.

“It is my view that the prosecution of Mr Collaery should end … I have therefore decided to exercise my power under section 71 of the Judiciary Act not to proceed with the prosecution.”

The news was enthusiastically greeted by Human Rights Law Centre senior lawyer Kieran Pender, who labelled it an important day for Australian democracy.

“Bernard Collaery should never have been prosecuted … whistleblowers should be protected, not punished – it’s as simple as that,” he said.

“From war crimes in Afghanistan to misogyny in Parliament House, there are many important stories that would never have been told were it not for the courageous actions of those who spoke up.”

Independent senator David Pocock, a critic of the government’s prosecution, also congratulated the attorney-general on the decision.

“This prosecution should never have gone forward in the first place … whistleblowers are a necessary safeguard and they need better protection,” he said on Twitter.