Labour Party leader David Cunliffe has resigned, effective next week, but at the same time thrown down the gauntlet to those in the party who want him to step aside from the leadership altogether.
He announced this afternoon that he will seek re-election through a primary leadership contest.
That means the new leader will be chosen - as Mr Cunliffe himself was last year - by an electoral college made up of 40 percent caucus, 40 percent party membership and 20 percent affiliated unions.
Mr Cunliffe made the announcement in Auckland at about 2.30pm today, after appearing in front of the party's ruling council.
It had been meeting today to set the terms of reference for a review of Labour's election campaign.
Mr Cunliffe said that Labour suffered an historic election loss and in resigning as leader he took responsibility for that.
"I have thought carefully before responding to the calls to re-offer myself for the leadership of the party," he said.
"Consultation with colleagues, members and affiliates has affirmed that the whole party must participate in this choice, and not just one part of it. Therefore I am announcing today that I will nominate for a primary contest."
Mr Cunliffe maintained that he had a lot of support within the caucus.
"I think there are a range of views right across the caucus and the party, as is proper. People are entitled to their opinions and I have great respect for other colleagues who might be interested. At the end of the day, I've made a decision that it's appropriate for there to be a choice and a contest so that everyone can have their say."
He said he expected the current deputy leader, David Parker, to be the acting leader of the party in the interim.
Grant Robertson to contest leadership
It is understood many caucus members wanted Mr Cunliffe to resign and not seek re-election, so that Grant Robertson and Jacinda Ardern could take over unopposed as leader and deputy leader respectively.
Mr Cunliffe said if someone else was chosen as leader, that person would have his 100 percent support - and he would expect the same if he was re-elected.
Mr Robertson has said he will contest the leadership, saying he believes he has something to offer.
"I will be putting my name forward for the Labour Party leadership. I believe that I have something to offer the people of New Zealand and the party. I think this is actually a great opportunity for us to re-connect with New Zealanders and for New Zealanders to see the Labour Party as part of their lives and as a positive influence."
He unsuccessfully ran for the Labour leadership last year against Mr Cunliffe and Shane Jones.
He said he thought he had more support in the party and unions than he did then.
Mr Robertson said with the party getting its worst election result in 92 years, it was time to take a new look at what it does.
Mr Cunliffe previously said that he thought the party should run a primary-style contest to decide who should be leader, and said he would stand in any such contest.
Mr Parker has said he would not stand as leader in any contest.
Napier MP Stuart Nash said he could consider a run at the leadership.
Labour MP Sue Moroney, a supporter of Mr Cunliffe, said a leadership contest was the right choice for the party.
She said party members have been telling her that they want to have a say over the future of the party and its leadership.
"The second message I've had from party members is how upset and angry they are with caucus members who have publicly been slating both the party and its leadership. They just want that to stop."
Mr Cunliffe has been a MP since 1999 and was Minister of Health in the last Labour Government between 2005 and 2008.
He was elected Labour leader on 15 September 2013.