Corrections officers barricaded themselves and a prisoner inside a van after its tyres were slashed and shots fired at a tangi in Waikato.
A minimum security prisoner had been given permission to attend a family member's funeral at a marae on Thursday afternoon, and was escorted there by corrections officers from Waikeria Prison.
Police said most of those attending the tangi were gang members.
At about 12.45pm, a shotgun was fired into the air several times.
Waikeria Prison general manager Rosemary Firth said the guards immediately returned to the escort vehicle, only to find its tyres had been slashed. They locked themselves inside and called for help.
"The tyres of the prisoner escort vehicle had been damaged, so they secured themselves and the prisoner inside the vehicle while additional staff and vehicles from the prison were immediately dispatched to the area. All staff and the prisoner safely returned to the site without further incident."
The corrections officers involved had shown "exceptional courage", Firth said.
"Our staff did an excellent job responding to a incredibly challenging situation and I would like to acknowledge them for their professionalism and bravery. They moved swiftly to secure the prisoner to ensure no risk to public safety and their actions ensured the safety of the prisoner and their colleagues," she said.
"Threats and intimidation towards our staff are unacceptable, especially when they're trying to do the right thing by allowing a prisoner to mourn the loss of a loved one."
Corrections later said the prisoner who ended up barricaded in the prison van with Corrections officers after the shots were fired had nothing to do with the incident.
Deputy Commissioner in charge of men's prisons, Neil Beales, told Midday Report staff acted correctly.
"My understanding is that the prisoner who they were with was not part of any disturbance, cooperated with the staff completely and is equally upset with what happened as anyone else is, so I think we have to bear that in mind.
"But our staff did absolutely the right thing, preservation of life and their safety is always paramount."
Beales said the incident was still under investigation by both police and Corrections.
The Corrections investigation would look at whether the release plan was adequate and staff had the resources they needed.
However, it was impossible to completely eliminate risk in such situations, he said.
"The reality is we have staff and prisoners out in public on any given day for a multitude of reasons whether it be going to hospital, transfers between court and prison or attending a tangi or a funeral, and of course we've only got limited control over what happens once we leave the confines of a prison establishment."
A person who was at the funeral has told RNZ while emotions were running high that day, they do not believe the guards were actually in real danger.
They said the gunshot was a tribute, and while the tyres were interfered with, it was motivated by those wanting the prisoner to be able to stay longer at the funeral.
They disputed the police's characterisation that most of the attendees were from a gang, although they accepted there were gang members there.
The police said a shotgun shell was found near the Department of Corrections' van, and enquiries were being made to identify and find the person who pulled the trigger.
Waikeria Prison was currently undergoing a large redevelopment project, which has been pushed back several times. It was where New Zealand's biggest prison riot happened over the 2020/2021 New Year period, when 17 inmates burned a high-security unit to the ground, in protest over "inhumane" conditions.
Call for 'rethink' on gang tangi visits
Corrections Association national president Floyd du Plessis said everything seemed "clear at first" when officers arrived, "but what did become evident is there was a large gang presence".
He called it an "extremely traumatic situation for staff" but not unique.
"It is something that does happen, sadly. We deal with some pretty dangerous individuals out there in the community, and so there have been other examples of exactly this situation happening where staff have gone to external escorts and [found] large numbers of gang members and them having a negative reaction.
"Unfortunately, it's one of the problems that we face because there tends to be a lot of criticism on us when we don't facilitate visits for things like tangi. But people need to understand these things are dangerous, and when you're going to a tangi where there's a large gang presence, things can go wrong. And that is exactly what happened in this instance."
Du Plessis said protocol around letting prisoners attend tangi needed a "rethink".
"The reality is that it used to be a lot stricter and there used to be a lot more rules around gang presence. Unfortunately, that has softened over a number of years, and so that is something that does need to be re-evaluated and reconsidered for the safety of everyone - both staff, prisoners and the public that are there."
He was not aware if the were any plans to tighten the rules for tangi where gangs might be involved.
"It is definitely something we'll be raising with the national commissioner and having a discussion with him around what unfolded and what safety procedures need to be put in place to prevent this happening again."