Associated Press 

Armed police were guarding and investigating at an Auckland supermarket on Sunday, two days on from a terror attack which saw seven people injured.

The knife attack on Friday at the Countdown supermarket was perpetrated by an extremist inspired by the Islamic State group, authorities said.

Court documents named the attacker as 32-year-old Ahamed Aathil Mohamed Samsudeen, a Tamil Muslim from Sri Lanka who arrived in New Zealand 10 years ago on a student visa seeking refugee status, which he was granted in 2013.

Undercover officers monitoring Samsudeen from just outside the supermarket sprang into action when they saw shoppers running and heard shouting, police said, and shot him dead within a couple of minutes of him beginning his attack.

Of the seven injured the youngest victim was a 29-year-old woman, the oldest a 77-year-old man.

The attack has highlighted deficiencies in New Zealand's anti-terror laws, which experts say are too focused on punishing actions and inadequate for dealing with plots before they are carried out.

Prime Minister Jacinda Ardern said lawmakers were close to filling some of those legislative holes when the attack occurred.