Police in New Zealand shot and killed a "violent extremist" after he stabbed and wounded at least six people in an Auckland supermarket.
Prime Minister Jacinda Ardern said the incident was a "terrorist attack" carried out by a Sri Lankan national who was under police surveillance.
The man, who has not been officially named, was a supporter of the Islamic State (IS) terrorist group, she said.
Police killed the man within 60 seconds of the attack on Friday.
"What happened today was despicable, it was hateful it was wrong," Ms Ardern said in a news conference. "It was carried out by an individual, not a faith."
Of the six wounded people, three are in a critical condition and one is in a serious condition, health officials say.
"The hospital staff are doing everything they can to preserve their lives," Auckland Mayor Phil Goff told the BBC.
"We're all horrified by what's happened. But... justice came pretty swiftly for the offender," he added.
How did the attack unfold?
It happened at the Countdown supermarket at LynnMall in the Auckland district of New Lynn on Friday afternoon.
Police commissioner Andrew Coster said a surveillance team and a specialist tactics group had followed the man from his home to the supermarket. But while there were concerns about the him, officials said they had no reason to think he was planning an attack on Friday, and the team believed he was going to do his grocery shopping.
After entering the store, however, the attacker got hold of a knife and went on a stabbing spree.
Shopper Michelle Miller told local news outlet Stuff that the man was "running around like a lunatic" and attacking people.
"All I heard was a lot of screaming," she said.
"[People were] running out, hysterically, just screaming, yelling, scared," another witness said, adding that he saw an elderly man lying on the ground with a stab wound.
Witnesses also said the attacker had shouted "Allahu akbar" (God is greatest).
Mr Coster said police rushed over upon hearing the commotion and shot and killed the attacker when he charged at the officers with the knife.
Footage from the supermarket shared online showed people fleeing before the sound of gun shots could be heard.
Extremism rears its head - again
Analysis by Phil Mercer, BBC News
This callous act in Auckland will stir painful memories of the deadly mosque attacks in Christchurch in 2019.
In that attack, a lone gunman - a self-confessed white supremacist - murdered 51 worshippers. Once again, New Zealand's geographic isolation and peaceful reputation have proved to be no defence against extremism.
The assailant had, for years, been identified as a threat to national security and was under 24-hour surveillance.
The police acted decisively to prevent further carnage, but they weren't close enough to stop serious injuries. New terror laws could, however, allow volatile individuals to be detained in the future.
Australian Prime Minister Scott Morrison has sent a message of support: Kia Kaha New Zealand, he wrote, using Maori words. Stay strong.
What do we know about the attacker?
The man, whose identity cannot be revealed due to court suppression orders, arrived in New Zealand in October 2011. He became a person of national security interest in 2016.
He had been under round-the-clock monitoring and heavy surveillance due to concerns about his ideology. He was known to multiple agencies, and was also on a terror watchlist.
Local media reports said the attacker was 32 years old and had recently been sentenced to one year of supervision for possessing IS propaganda.
Prosecutors had accused him of plotting a "lone wolf" terror attack using knives, but the judge ruled that planning a terror attack was not in itself an offence under existing laws, the reports said.
His internet search history and bookmarks included heroes of Isis, Islamic State dress, and New Zealand prison clothes and food, according to Stuff.
Ms Ardern said that until Friday, he had not committed any offence. When asked about the man's motivations, she said they were "Isis-inspired".
Questions have been raised about why action against him was not taken before six people were injured - especially since he was under close surveillance.
"The reality is, that when you are surveilling someone on a 24/7 basis, it is not possible to be immediately next to them at all times. The staff intervened as quickly as they could and they prevented further injury in what was a terrifying situation," said Mr Coster.
He added that the attacker was very surveillance-conscious, and that teams needed to maintain a distance to be effective.
Authorities are confident the attacker was acting alone and that there is no further danger to the community, according to Mr Coster.
Were you in the area? Did you witness the incident? If it is safe to do so please share your experiences by emailing firstname.lastname@example.org.
Please include a contact number if you are willing to speak to a BBC journalist. You can also get in touch in the following ways: