Mass shootings at two mosques in Christchurch killed 49 people on what Prime Minister Jacinda Ardern called “one of New Zealand’s darkest days”.

Authorities have detained four people and defused explosive devices in what appeared to be a carefully planned attack.

Ms Ardern said the events in Christchurch represented “an extraordinary and unprecedented act of violence” and acknowledged many of those affected may be migrants and refugees.

She said more than 20 people were seriously wounded.

“It is clear that this can now only be described as a terrorist attack,” Ms Ardern said.

Police took three men and a woman into custody after the shootings, which shocked people across the nation of five million people.

Authorities have not elaborated on who they detained. But a man who claimed responsibility for the shootings left a 74-page anti-immigrant manifesto in which he explained who he was and his reasoning for his actions. He said he was a 28-year-old white Australian.

Australian prime minister Scott Morrison confirmed that one of the four people arrested was an Australian-born citizen.

Ms Ardern at a news conference alluded to anti-immigrant sentiment as the possible motive, saying that while many people affected by the shootings may be migrants or refugees “they have chosen to make New Zealand their home, and it is their home. They are us. The person who has perpetuated this violence against us is not”.

Ambulance staff with a man outside a mosque in central Christchurch (Mark Baker/AP)

Police Commissioner Mike Bush said police were not aware of other suspects beyond the four who were detained but they could not be certain.

“The attackers were apprehended by local police staff. There have been some absolute acts of bravery,” Mr Bush said.

“I’m hugely proud of our police staff, the way they responded to this. But let’s not presume the danger is gone.”

Mr Bush said the defence force had defused a number of improvised explosive devices that were attached to vehicles stopped after the attacks.

He said anybody who was thinking of going to a mosque anywhere in New Zealand on Friday should stay put.

The deadliest attack occurred at the Masjid Al Noor mosque in central Christchurch.

Ms Arden said 30 people were killed there.

What has happened in Christchurch is an extraordinary act of unprecedented violence. It has no place in New Zealand. Many of those affected will be members of our migrant communities – New Zealand is their home – they are us.

He said the gunman was white and was wearing a helmet with some kind of device on top, giving him a military-type appearance.

A video that was apparently live-streamed by the shooter shows the attack in horrifying detail. The gunman spends more than two minutes inside the mosque hitting terrified worshippers with bullets.

He then walks outside to the street, where he shoots at people on the pavement.

The gunman then walks back into the mosque, where there are at least two dozen people lying on the ground.

After walking back outside and shooting a woman there, he gets back in his car, where the song Fire by English rock band The Crazy World Of Arthur Brown can be heard blasting from the speakers.

2/6 …one at Deans Avenue and one at Linwood Avenue. Those locations remain locked down.We can confirm there have been a number of fatalities. We cannot at this stage confirm the precise number but it is significant. So far, four people, three men and a woman, have been taken…