A law-making bungle deprived our spies of a key weapon against terrorism in the wake of classified briefings warning of "an increasingly complex and escalating threat environment" in New Zealand.
NZ Security Intelligence Service documents revealed the blunder left our spies unable to use video surveillance tools to watch terrorism suspects in their cars, homes or workplaces for six months last year.
The documents, declassified and released through the Official Information Act, also revealed our spies have been involved in "high threat operations".
It did not state what those operations were and NZSIS director-general Rebecca Kitteridge, in an interview with the NZ Herald, would not elaborate other than to say they involved police assistance
She would not give details of the operations but said the NZSIS had taken active steps with the police to stop people who wanted to carry out terrorist attacks in New Zealand.
The details about the security situation in New Zealand is an unnerving backdrop to the blunder over warrants allowing visual surveillance.
Kitteridge revealed the hole in the law to former NZSIS minister Chris Finlayson last year.
In a memo on June 30, she said "the NZSIS no longer had the power to apply for a visual surveillance warrant" or to use emergency power to act without a warrant in emergencies.
• David Fisher: This is how our security services expect terrorism to strike NZ
• Analysis: 'Trust me I'm from the government'
• The Big Read: How our spies wound up getting Kiwi data 'unlawfully'
The memo said warrants to allow visual surveillance were to "detect, investigate or prevent a terrorist act".
But she said the NZSIS was unable to do so for six months after the old law expired on April 1 2017 because the new Intelligence and Security Act did not apply until September 28 2017.
"Don't even bother asking"
In a handwritten note, Finlayson told Kitteridge: "You will not be seeking a legislative solution AT ALL. Don't even bother asking."
The papers showed that the blunder was not caused by the NZSIS but the Department of Prime Minister and Cabinet which was responsible for meshing expiring and new laws.
She said she did not believe the NZSIS needed its visual surveillance powers during the time there was a hole in the law. "It is one of the tools we have in the toolbox but we have others.
"I don't think any of us thought it was ideal … but it was what it was. Obviously it wasn't ideal. We were very pleased and relieved when (the new law) came into force on the 28th of September."
The legal ability to get warrants allowing visual surveillance is rarely sought as it is one of the most intrusive powers available to our spies.
It allows the NZSIS to legally enter places usually owned by others and to plant bugs that relay video imagery with the warrant covering the period of time the device is left in place.
The NZSIS used the power twice in the year ending June 2015 with those warrants continuing into the 2016 reporting period, during which time another warrant was granted. In the year ending June 2017 - which included three months when it was legally impossible to gain a warrant for visual surveillance - there was just one granted.
Kitteridge conceded New Zealand could have faced an immediate threat which required urgent use of the power and that was why she told Finlayson.
Her briefing paper to Finlayson made it clear she was not seeking a law change to fix the error, telling the Herald there was no "realistic" chance any such request would be granted.
"My judgment was we would be able to manage until the (new law) came into effect."
Threats against NZ growing
Among Kitteridge's briefings to Finlayson was the warning in August 2015 that New Zealand faced a "growing number and seriousness of threats" that were mainly terrorism-related.
He was told our defence against such threats was beyond the NZSIS abilities to manage as it went through an overhaul and took on more staff.
Kitteridge told him "in the context of the threat environment we are facing, the NZSIS's capabilities will continue to be less than the demand on our services".
"We will need to continue making difficult prioritisation decisions about which targets we investigate (and for how long) and which we do not."
Kitteridge told the Herald earlier reviews of the NZSIS showed "it was clear the Service needed to be strengthened".
"We weren't able to do the work we needed to do for New Zealand with the resources that we had".
The NZSIS got an extra $7m a year in 2014 and 2015 and received further funding as part of a wider 2016 budget boost to the intelligence community of $178 million over four years.
The documents show the NZSIS was anticipating doubling staff numbers by 2020. Based on the 225 staff the NZSIS declared in its 2014 annual report, that would take it to 450 people.
In 2016, Kitteridge again warned Finlayson of "an increasingly complex and escalating threat environment" amid other pressures on the Service - the ability to provide "consistent effective support" to the NZSIS oversight body, the Inspector General of Intelligence and Security.
Kitteridge told the Herald there were periods when the NZSIS was "more worried" than others.
"That might be because people leave the country or go through the judicial system or … because they get married and settle down. The reality is there are new people coming across our radar on a regular basis."
The rollback of Isis in Syria and Iraq had not ended the threat, she said.
Talk of attacks on New Zealand
"There are still people in New Zealand who subscribe to those views and we still have individuals in New Zealand who range from talking about conducting attacks to supporting facilitation or wishing to travel."
Asked if the NZSIS had stopped an attack, she said: "What I would say is that we have been aware of individuals who have been interested in conducting an attack and we have worked in police in those cases."
She would not comment on whether these cases were among those which had appeared in courts recently.
In a statement, DPMC deputy chief executive Howard Broad said: "This was an oversight that occurred during the development of the bill and was not picked up by DPMC or the agencies during its passage."
Finlayson would not be interviewed but issued a statement which read: "This was a technical oversight and I was very unimpressed given the huge amount of work over many months that had been put into drafting the new legislation."
Finlayson said he had gone through the law change "clause by clause with officials" and had told them "they had one last chance to indicate any concerns they may have had".
"There were none."
Finlayson said Parliament was in its closing stages prior to the election and he had "no intention of trying to ram stop-gap remedial legislation through the House".
Labour's Little backs Finlayson's call
NZSIS minister Andrew Little said he supported Finlayson's exercise of judgment and would have made the same decision.
Kitteridge's briefings to Finlayson - and others in the documents - paint a picture of a dynamic and dangerous level of activity with which New Zealanders would generally struggle to identify.
The 2014 State Services Commission review of the intelligence community stated: "Few New Zealanders have a realistic awareness of the level of threats facing them personally, their commercial enterprises, and New Zealand."
It advised the NZSIS and Government Communications Security Bureau "to assist in developing a greater public understanding and awareness of the threats facing New Zealand" and what citizens could do to reduce risk to the nation.
The OIA request sought information about NZSIS compliance procedures - the systems which monitor the Service's ability to follow its ethical and legal obligations. The documents show the systems were weak when Kitteridge took over but significant resource has gone into creating and compliance unit and boosting its legal team.
The NZSIS received certification for its compliance system last year from the IGIS - two years after 45 recommendations for change were made in a review of its systems.
The overhaul of the intelligence agencies began in earnest in 2014 after the discovery the electronic spying agency, the Government Communications Security Bureau, was illegally spying on people because of a mistaken understanding of the law.
David Fisher is a member of a Reference Group formed by the Inspector General of Intelligence and Security intended to hear views on developments possibly relevant to the work of the oversight office. The group has a one-way function in offering views to the IGIS. It receives no classified or special information from the IGIS or the intelligence community. The information in this story was not sourced from Reference Group discussions.