When Jim Campbell joined the Department of Conservation more than 25 years ago, he never expected his job would involve shooting whales.
But Mr Campbell, a senior ranger with DoC Whanganui, is one of just a handful of people in New Zealand authorised to use the Sperm Whale Euthanasia Device, or SWED.
At a moment's notice he may be called upon to travel to a remote stretch of coastline to perform a mercy killing on a stranded sperm whale.
"Sperm whales are the most difficult to deal with - refloating them once they've stranded is virtually impossible," Mr Campbell said.
"They weigh up to 30 tonnes - they're big, chunky creatures and they're lying stranded on the beach cooking from the inside out. So the SWED is a way to stop long-term suffering for them."
A stranded whale is not shot as a matter of course; many factors are weighed before the decision is made to euthanise a stranded animal.
Mr Campbell said each case was judged according to the conditions of the day, and whether the animal was likely to be successfully refloated.
The amount of time a whale can survive a stranding varies - a sick, stressed or old whale may take as little as half an hour to die, while a fit and healthy one can take days.
Shooting a whale to put it out of its misery is not a matter of simply pointing the gun and pulling the trigger. It is a highly skilled job which involves firing a bullet directly into the whale's brain.
"You're aiming to hit something the size of a rugby ball in the middle of a great big mass. The bullet has to pass through skin and blubber and bones and meat and, obviously, for safety's sake, it can't come out the other side."
A sound knowledge of the anatomy of a whale's skull is necessary, as well as the ability to use the SWED. It must be held at exactly the right angle, at the side of the creature's head. It requires such precision that a spotter is needed to stand at the front of the whale to guide the shooter and ensure the SWED is level.
"If you get it an inch out, you're shooting in the wrong place."
As a matter of course, three bullets are always fired to ensure the whale is dead. Its death may be immediately obvious, such as the jaw going slack, or it may give no sign at all.
Mr Campbell said shooting a whale was an emotional experience.
"They look you right in the eye - they know exactly what's going on. A stranded whale is a very significant presence," he said.
There's also the pressure of the situation. It is seldom that Mr Campbell and his team are alone on the beach, no matter how remote. The local iwi is always present and, usually, members of the public as well.
The SWED was developed in the 1990s by former Wanganui man Craig Bamber, a volunteer DoC contractor who is passionate about both whales and ballistics.
"The idea of developing a weapon for humanely euthanising whales had been kicking around for some time ... it was just a matter of how to do it," Mr Bamber said.
"I took it on because I have a passion for it."
A variety of weapons were tested over several years in what Mr Bamber describes as "a huge concerted effort".
"You couldn't possibly quantify the cost of developing the SWED."
Mr Bamber and the SWED are both now based in Wellington - a central location for the rifle to be moved to wherever it is needed.
The final version of the SWED is a highly modified World War II Russian anti-tank rifle. It fires a single shot 15mm-diametre bullet, and generates 26,000 foot-pounds of energy - 10 times that of a .308 rifle.
The bullets, which are produced in New Zealand, have to be custom made.
Jim Campbell, along with Norm Marsh, Anton Van Helden and Hans Rook from DoC and Te Papa, were also involved in the development of the SWED. It was Mr Campbell's role to test the different weapons, by shooting whales which had already died.
"I cut up a lot of whales to look inside their brains," he said.
In 2014, he travelled to London to present information about the SWED to the International Whaling Commission's working group on euthanasia methods.
"There was a lot of interest, and it has now been accepted by the IWC as a recognised method for euthanising sperm whales."
New Zealand and Iceland are the only countries to use ballistics to euthanise whales.
Other countries, such as the United States, use chemical injections, which Mr Campbell said were problematic.
"You need a lot of it, and it can take the whale a long time to die. And once it has died, there's the question of what to do with it - you've basically got 30 tonnes of toxic waste lying on the beach."
The SWED, however, was relatively straightforward in the hands of an expert.
"When it's done right, the whale dies instantaneously."
Mr Campbell is now focused on training others to use the SWED - and understanding the anatomy of the whale's head is the hardest part.