A man suspected of killing two unemployment office workers and critically injuring a third has been arrested following a manhunt that lasted seven hours and kept a town on edge.
Police spokeswoman Lisa-Marie Brooks said a police dog unit apprehended 48-year-old John Tully near a lake shortly after 5pm local time following an extensive manhunt in the South Island town of Ashburton.
She said Tully would be treated for minor dog-bite injuries. She said police were still searching for the weapon used in the shootings and a decision on whether to press charges would probably be made tomorrow.
Earlier, police urged residents to remain inside their homes as they searched an area near the town's river and stormed a house that turned out to be empty.
Tully had been interviewed in recent weeks by the local newspaper about his struggles finding somewhere to live and had also written to politicians.
The incident began at about 10am local time when police said a man entered a Work and Income New Zealand office and started shooting.
A witness said the man was wearing a black balaclava and shot at two women, according to the Ashburton Guardian newspaper. Other witnesses told the paper the man was carrying a shotgun that may have been sawed down and fled on a bicycle.
Ministry of Social Development chief executive Brendan Boyle said all three victims worked for the agency.
"We are all devastated by the deaths of two of our colleagues in the shocking attack," he said in a statement, adding "our thoughts and prayers" are also with the third victim.
The agency declined to provide any details about the victims.
Politician Winston Peters said in a statement that Tully had emailed his party on August 14 about the difficulty of finding somewhere to live.
"We replied immediately and also followed up," Mr Peters said. "However, the emails kept bouncing back."
Last month Tully told the Ashburton Guardian that he had previously worked in Australian mines, but returned to his hometown and ended up living in a tent after being unable to secure government-assisted accommodation.
Ashburton Mayor Angus McKay said the town was very community-minded and the tragedy would affect many lives: "It just hits home real hard," he said, according to The New Zealand Herald newspaper.
Ashburton is home to about 18,000 people and is 56 miles (90km) south-west of Christchurch.