Australia's attorney-general says a contentious new law that carries a prison term for anyone who reveals information about certain secret security operations was aimed at Edward Snowden-like leakers rather than investigative reporters.

Attorney-General George Brandis announced on Thursday that he was adding a safeguard for journalists who might fall afoul of a new counterterrorism law by giving the attorney-general at the time power to veto any media prosecution.

The most contentious section of counterterrorism legislation passed Wednesday by the Senate carries a potential 10-year prison sentence for anyone who discloses information that relates to a "special intelligence operation."

Brandis says that section is primarily "intended for a Snowden-type situation," referring to the former U.S. National Security Agency contractor who leaked thousands of classified documents.