James Shaw distinctly remembers the speech he made in 2017 that he feared was not only his own valedictory but that of the entire Green Party caucus.
It was the final day of Parliament before the House rose and all parties headed out on the campaign trail.
Shaw did the adjournment speech for the Greens and 10 minutes before he headed to the House to deliver it, he received the latest Colmar Brunton polling that had the party on 4 percent.
"That was the most horrible feeling," he told RNZ in a sitdown interview ahead of his final day at Parliament on Wednesday.
The party had suffered an 11 point drop and "we were underwater, so I had to give that speech knowing there was a realistic possibility it was going to be the last speech by a Green Party member of Parliament".
Shaw said he could have stomached it if it was just his own valedictory, but instead he felt the weight of "20 years of history and all those other MPs who had fought so long to try and get us into government".
"That was one of the lowest points of that particularly rough campaign."
Shaw found himself in that situation after Metiria Turei resigned as co-leader just six weeks out from the election. Her position had become untenable after admitting to historic benefit fraud and enrolling at an address she was not living at to vote.
It all began at the party's annual meeting in July when Turei used her speech to reveal as a single mum struggling to raise her daughter in the 1990s, she lied to stop her benefit being cut.
Initially the party received a bump in the polls, but as the story shifted over the course of the coming weeks, pressure went on Turei to resign.
Turei had been co-leader since 2009, while Shaw had only been in the job since May 2015.
"I think a lot of people still look back at that speech and say she was admitting to benefit fraud, almost as if she was trying to get it off her chest or something. That wasn't the point.
"She was trying to demonstrate that there are people whose situations are so dire they feel like they have no choice but to do that, and that she had been in that situation herself.
"And you've got to remember in the week or so after that our polling went up four or five points - at one point I think we were on 16 or 17 percent - so people responded to that," Shaw recalled.
Then came a period where "she was essentially hounded and all the rationale for making that speech got buried under this kind of attack," he said.
When Turei was found to have also enrolled at an address she did not live at, Shaw said he knew the walls were closing in.
"I remember getting that phone call that night, I was in a van on my way to Ōtaki to do a public meeting there.
"That was when I knew we were in real trouble, because it was clear people were out looking for any piece of evidence to destroy the narrative she'd put out there and to paint her as this bad person who was just a serial lawbreaker and it's very hard to fight once once it sticks," he said.
Within 48 hours Turei had refused to resign, but said she wouldn't seek any ministerial positions if Labour and the Greens were in power after the election. About the same time then-Labour leader Jacinda Ardern said she had made it clear there would not be a ministerial role for Turei.
Reflecting on that, Shaw said he was not that bothered by it because everyone plays the 'rule in/rule out' game during campaigns.
"Then what happens is people actually get to vote and then you get into negotiations so I've always taken all that rule in and rule out stuff with a great big dose of salt."
Within another 24 hours Turei had resigned as co-leader. Shaw said he gets angry when he thinks back to that time.
"Frankly I didn't have time to dwell on that though because after her resignation all I had to do was just focus on making sure the Greens were back in government, so I had to park a lot of that.
"I could argue that we could have done a better job of doing a critical analysis of that before we did it, to say how might this play out, but I'm not going to take all the responsibility for that because I do think the way it played out was symptomatic of this larger trend we have of this kind of real negative personality based politics, where people try and undermine each other as people, rather than to focus on the policy positions and argue about how we want to be as a country."
Shaw said the risk was that MPs did not "tell the truth because they're so fearful of the backlash".
As the 2017 election inched closer, Shaw said he did not have any conversations with National or Labour about coalition negotiations, despite it being clear New Zealand First would be in a kingmaker role and it could go either way for Ardern and Bill English.
"We were so focused on the campaign that we thought we'd deal with that later. We'd played out scenarios and gamed it out a bit, but after that crash in our polling we had to park all that work and our one job was being back in Parliament," he said.
As for the 2023 election campaign, Shaw said the Greens and Labour were being clear with their voters about the government they were proposing and there were not any formal conversations with National.
But there was one chat, after the election result and while coalition talks were underway.
Shaw met with Christopher Luxon and Nicola Willis in his caretaker Climate Change Minister capacity to "ensure there was a smooth transition".
"We kind of casually discussed it, but the onus was on them - they never asked us to negotiate with them.
"It sort of became something of a moot point - my conversations with them were in my capacity as Climate Change Minister, and it was pretty peripheral because they were pretty advanced in their negotiations with Act and New Zealand First."
By the time the 2023 election result came round, the Greens had broken history records in both the number of electorates won and the size of the caucus headed to Parliament.
The only bad news for the party in all that was being tipped out of government and back into opposition.
Shaw said he had come to the conclusion that was likely to happen around Christmas of 2022.
"You didn't have to be a genius a year in advance to know that was a likely scenario.
"But I didn't want to die not knowing so we put everything into it and fought the best race we ever had."
When he confirmed to family, friends and staff earlier this year that he was calling time on politics, the overwhelming feeling that flooded over him was "relief".
"It's been the greatest privilege of my life, it really has, and it was the hardest thing I've ever done, and probably will ever do, and by the end of it I was not in great shape," Shaw said.
"If we'd won a third term of government it would definitely have been my last because I wouldn't have been able to physically or emotionally sustain another after that.
"Because I think I'd gone through my grieving process for not being in government, by the time I got to election night I had a sense of relief for myself and a sense of real pride and joy that the Greens had had their best night in all of our history.
"And it's hard to walk away feeling sad about any of that."