THE shock announcement by New Zealand’s prime minister, John Key, that he will step down on December 12th has caught the country on the hop. First elected in 2008, he remained popular and was widely expected to win a rare fourth term in office in a general election next year.

The 55-year-old Mr Key, who said he was standing down for the sake of his family, announced that he will back Bill English, the deputy prime minister and finance minister, when the MPs from his centre-right National Party pick a new leader next week. The opinion polls all say that Mr Key and his government are popular, with a wide lead over the opposition Labour Party.

It is not hard to see why. On a long list of yardsticks his country of only 4.7m people—“the last bus stop on the planet”, as Mr Key puts it—has been a striking success. The World Bank recently rated it the easiest place on Earth to do business. The Legatum Insitute, a think-tank in London, judged it—by crunching nine different criteria—the world’s most prosperous spot. Transparency International, a Berlin-based anti-corruption monitor, reckons it to be the world’s fourth most honest. A clutch of other league tables puts it in the top ranks for happiness, health, democracy and freedom, among others. Bloomberg recently reported that a growing band of magnates from America, Russia and China (among them Jack Ma of Alibaba, reckoned to be China’s richest man) have bought, or want to buy, hideaway homes in safe and beautiful New Zealand.

The figures testify to New Zealand’s perkiness. The city of Christchurch, near the epicentre of a devastating earthquake in 2011, in which 185 people perished, is bouncing back. The national economy grew by a healthy 3.6% in the year to July; unemployment is under 5%. The workforce-participation rate is one of the highest in the world. Wages have risen by 9% in real terms since 2008. All this is because the Kiwi economy has grown much faster over the past decade than those of most rich countries. Australia, its closest neighbour, is a galling exception (see chart).

Even so, the once steady flow of New Zealanders seeking a better living in Australia, which is 28 times bigger in area and home to five times as many people, is now reversing. Newcomers are coming in thick and fast from elsewhere, including China, India and other parts of Asia. A quarter of the residents of Auckland, the commercial capital, where a third of New Zealanders live, were born abroad, mostly in Asia. Ethnic Chinese, a fast-growing group, make up 4% of the country’s population.

A flexible visa regime brings in immigrants with desirable skills. The mega-rich can win residence double-quick by depositing a suitably large dollop of investment. While dairy products and meat are still the country’s main exports, tourism, especially from China, is booming, up 18% in the past year. Services are growing fast too. After Donald Trump’s election victory, New Zealand’s immigration department received a surge of inquiries from America.

New Zealand’s economic upswing began in the mid-1980s under an audaciously reforming Labour government that was, in the words of Mr Key, “amazingly right-wing”. Subsidies that, among other things, fattened farmers were wiped out, tariffs dropped and investment opened up.

Since then, New Zealand has eagerly fostered free-trade agreements around the world, most notably with China in 2008—the first among the rich countries of the OECD to do so. “If you can’t do a high-quality FTA with New Zealand quickly, you can’t do it with anyone,” says the trade minister, Todd McClay. The only recent hiccup on this drive to free trade is the rejection by Donald Trump of the 12-country Trans-Pacific Partnership, which New Zealand has keenly encouraged. Asked if China, which has hitherto not taken part, could replace America to rescue the agreement, Mr McClay says, “It’s certainly something America should be thinking about.”

Mr Key, a former currency trader in Singapore and London whose own wealth has been reckoned at more than $35m, has applied what he calls a policy of “radical incrementalism”. He has lowered income-tax rates (to 33% at the top), trimmed the national debt to 25% of GDP and partially privatised a batch of state utilities. At the same time he has raised the goods and services tax from 12.5% to 15%, reformed health care and increased various benefits (for instance, by making prescriptions and visits to the doctor free for children under 13).

The opposition Labour Party laments that house prices are rising fast (by 13% in the past year), as is homelessness, especially in Auckland, where the opposition recently won a parliamentary by-election handsomely. Mr Key has admitted that his biggest worry, apart from drought or a global crash, is a housing bubble, which is why he says house-building is a priority.

Mr English, who is less chirpy than Mr Key and led his party to a resounding defeat in 2002, was briefly challenged for the ruling party’s leadership by two colleagues in the cabinet. But they have withdrawn, paving the way for his coronation. Labour, on its fourth leader since Helen Clark was beaten by Mr Key in 2008, has won a measure of stability since 2014 under Andrew Little, a steady former trade unionist who calls for greater fairness, focusing on the rise of homelessness. His lot has agreed to co-operate with the Green Party—a tactic that helped it to its by-election victory in Auckland. Meanwhile Winston Peters, who leads the populist New Zealand First party, is calling for curbs on immigration and the free market. Although his party only polls around 10%, it could end up holding the balance of power in a close election.

Whether or not the National Party retains power next year, Mr Key must go down as one of New Zealand’s most successful leaders. Under his stewardship, the country can claim to be one of the world’s most successful, too.