Prime Minister John Key resigns after eight years in power, calling it the hardest decision he has ever made.

New Zealand’s popular Prime Minister John Key has unexpectedly announced his resignation, saying he was never a “career politician” and it was the “right time” to go after eight years in the job.

Key had been widely expected to contest his fourth general election next year. But he said he wanted to ensure he did not make the mistake that some other world leaders have done, and instead wanted to leave while he was on top of his game.

The former Merrill Lynch currency trader called it “the hardest decision I’ve ever made”, with no plans on what to do next other than spend more time with his family.

Today I announced my resignation as Prime Minster and Leader of the National Party. https://t.co/gf6uEV3M11 — John Key (@RtHon_JohnKey) December 5, 2016

“Being leader of both the party and the country has been an incredible experience,” he told a regular weekly news conference.

“But despite the amazing career I have had in politics, I have never seen myself as a career politician.”

READ MORE: Australia PM warns New Zealand against taking refugees

Key recently marked his eighth anniversary as prime minister and 10th year as leader of the centre-right National Party, which is due to meet next week to elect his successor. His deputy Bill English is widely seen as favourite to take over.

Opinion polls have consistently pointed to Key becoming the first political leader in New Zealand history to win four consecutive elections when the country votes next year, but he said records were not a consideration.

“If you’re staying for the record of the time you’re staying for the wrong reason,” Key said on Monday.

When he heard the news, Australian PM Malcolm Turnbull, right, sent his close friend Key a brief text message: ‘Say it ain’t so bro’ [Dean Lewins/Reuters]

Key came into politics relatively late, entering parliament in 2002 and assuming leadership of the centre-right National Party four years later.

In 2008 he ended nine years of Labour Party rule, ousting then Prime Minister Helen Clark.

He won plaudits for his leadership during a string of crises in his first term, including a devastating earthquake in Christchurch in February 2011 which claimed 185 lives.

The 55-year-old also steadied the economy after the global financial crisis without resorting to hardline spending cuts, instead taking a steady, pragmatic approach that saw the budget return to surplus in the 2015-16 financial year for the first time since 2008.

‘Say it ain’t so bro’

When he heard the news, Australian Prime Minister Malcolm Turnbull sent Key a brief text message: “Say it ain’t so bro”, telling reporters in Melbourne he considered his close friend “one of the most outstanding national leaders in the world today”.

New Zealand opposition Labour Party leader Andrew Little acknowledged Key was popular but said he understood why he was walking away.

John Key has served New Zealand generously and with dedication. I wish him and his family the best for the future. — Andrew Little (@AndrewLittleMP) December 5, 2016

“Politics requires much sacrifice. We may all be politicians, but not all our lives are politics,” Little said.

“The prime minister has served New Zealand through times of considerable global instability, and will leave politics proud of his achievements.”

It’s been an utter privilege and an honour to serve you as Prime Minister. https://t.co/4J4yk8HspF — John Key (@RtHon_JohnKey) December 5, 2016

New Zealand First leader Winston Peters claimed Key was stepping down because the economy was not as strong as the government made out.

But the prime minister said he felt he was “going out on top”, pointing to spending more time with his wife Bronagh and children Stephanie and Max as a key consideration.

“It would be easy to say I have made this decision solely to rediscover the personal and family life I once had, and that is a factor, but it is one among many,” he said.

READ MORE: New Zealand’s relentless housing crisis

“Over the years I have observed many leaders who, in a similar position, fail to take this step. I can understand why. It is a hard job to leave.

“But, for me and the National Party, this is a good time to go. Party membership is high and the party is well funded.”

Meanwhile, New Zealand Deputy Prime Minister Bill English said that he was considering running for the leadership the ruling National Party after the surprise of Key.

“I’ll be talking to caucus and family today and tonight,” English, who is also the finance minister, told reporters in Wellington.

“I wouldn’t stand if there wasn’t strong caucus support for me standing.”

English is considered the frontrunner to replace Key as prime minister in a party vote planned for next week.

Key said he would vote for English if he decided to stand.