New Zealand has put its largest city back into lockdown after recording four new Covid-19 cases, ending a 102-day streak without a local infection.
A three-day lockdown was swiftly imposed in Auckland after the cases were confirmed.
The four new cases are all members of a single family. None had travelled recently.
The restrictions will come into effect on Wednesday, as authorities scramble to trace contacts of the family.
Auckland residents will be asked to stay at home, large gatherings will be banned, non-essential businesses will be shut, and some social-distancing restrictions will be reintroduced in the rest of the country.
The country's Prime Minister Jacinda Ardern also on Wednesday deferred the dissolution of parliament, following the latest Covid-19 cases.
The dissolution of parliament, which is required to make way for a general election, has now been deferred until Monday.
Ms Ardern said no decision had yet been made on postponing the election - originally scheduled for 19 September.
"We have some time to work through that," she said, according to a TVNZ report.
New Zealand has fared better than other countries, recording 1,220 confirmed cases and 22 deaths since the virus arrived in late February.
Before Tuesday, New Zealand had gone 102 days without recording a locally transmitted case of Covid-19, one of the few countries to reach such a milestone.
All 22 active cases of the virus before Tuesday's announcement were among returning travellers quarantined in isolation facilities.
Praised internationally for its handling of the pandemic, the country's government had lifted almost all of its lockdown restrictions, first imposed in March.
An early lockdown, tough border restrictions, effective health messaging and an aggressive test-and-trace programme have all been credited with virtually eliminating the virus in the country.
But as infections continue to rise across the world, surpassing 20 million globally on Tuesday, New Zealand officials have warned against complacency.
Announcing the lockdown, Ms Ardern said it was necessary to go hard and go early to stamp out the virus.
Auckland - a city of around 1.6 million people - would move to level three restrictions from 12:00 local time (01:00 BST) on Wednesday as a "precautionary approach", she said.
The prime minister said the rest of the country would move to level two of New Zealand's 4-tier alert system of measures against Covid-19.
"This is something we have prepared for," Ms Ardern said at a news conference.
"We have had 102 days and it was easy to feel New Zealand was out of the woods. No country has gone as far as we did without having a resurgence. And because we were the only ones, we had to plan. And we have planned," she said.
Director-General of Health, Dr Ashley Bloomfield, said at least three days of lockdown were needed in Auckland to trace the source of the new cases.
"We're expecting to see other cases," Dr Bloomfield said. "We want to find those other cases as soon as possible and identify or isolate any contacts."
Michael Baker, professor of Public Health at the University of Otago, told BBC's Newsnight programme that even with the most successful strategies in dealing with the coronavirus outbreak "one thing you have to plan for is setbacks".
"I think New Zealand will succeed and get rid of the virus," he added.
In anticipation of a pre-lockdown rush to supermarkets, Ms Ardern and the mayor of Auckland, Phil Goff, called for calm, saying there was no need to panic-buy.
Despite their pleas, large crowds of shoppers were seen queuing at supermarkets on Tuesday night, as they attempted to stock up before lockdown.
One video posted to social media shows customers streaming through the door of a supermarket as a security guard tries to prevent them from entering.
Police are at New Lynn Countdown after people ripped the doors open when security tried to control the amount of people rushing in. That woman is saying she needs food for her kid. This ain’t it Auckland. pic.twitter.com/PDf1Oe26Mx— Matt Manukia (@MattManukiaTVNZ) August 11, 2020
The World Health Organization (WHO) had hailed New Zealand as an example to others for having "successfully eliminated community transmission".
But other countries have had early success in suppressing the virus, only to see infections rise again after lifting lockdown restrictions that damaged the economy.
Vietnam went 99 days with no community transmission until July, when a 57-year-old man in Da Nang tested positive for the virus.
By the end of July, Da Nang was the epicentre of a new coronavirus outbreak, leading to the country's first coronavirus death since the pandemic began.
Australia, too, has seen a resurgence of Covid-19 in some states, including New South Wales and Victoria, where a strict lockdown has been imposed.