A man is to appear in court in New Zealand charged with murder after 49 people were killed in mass shootings at two mosques full of worshippers attending Friday prayers.

Authorities detained three other people – two men and a woman – and defused explosive devices in what appeared to be a carefully planned racist attack in Christchurch.

Prime Minister Jacinda Ardern called it “one of New Zealand’s darkest days”.

She said the incident represented “an extraordinary and unprecedented act of violence” and acknowledged that many of those affected may be migrants and refugees.

In addition to the dead, health officials said 48 people were being treated at Christchurch Hospital for gunshot wounds. Injuries ranged from minor to critical.

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

Police took three men and a woman into custody after the shootings, which shocked people across the nation of five million people. One of the suspects was later charged with murder.

He was named as Brenton Tarrant, 28, from Australia, in media reports in his home country.

While there was no reason to believe there were more suspects, Ms Ardern said the national security threat level was being raised to the second-highest level.

POLICE New Zealand
(PA Graphics)

National carrier Air New Zealand cancelled at least 17 flights in and out of Christchurch, saying it could not properly screen customers and their baggage following the shootings.

Authorities have not specified who they detained, but said none had been on any watch list.

A man who claimed responsibility for the shootings left a 74-page anti-immigrant manifesto in which he explained who he was and the reasoning behind the attack. He said he was a 28-year-old white Australian and a racist.

Australian Prime Minister Scott Morrison confirmed that one of the four people detained was an Australian-born citizen.

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

Police Commissioner Mike Bush said on Friday night that a man had been charged with murder. He did not mention the other three suspects and did not say whether the same gunman was responsible for both attacks.

At a news conference Ms Ardern 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.”

On the suspects, she said: “These are people who I would describe as having extremist views that have absolutely no place in New Zealand.”

Mr Bush said police had found two improvised explosive devices in one car, a clarification from an earlier statement that there were devices in multiple vehicles. He said they had disabled one and were in the process of defusing the second.

Police said the investigation had extended 240 miles to the south where homes have been evacuated around a “location of interest” in Dunedin.

The deadliest attack occurred at the Masjid Al Noor mosque in central Christchurch at about 1.45pm. At least 30 people were killed there.

New Zealand Mosque Shooting
Prime Minister Jacinda Ardern gives a press conference from Wellington after the mosque shootings in Christchurch (TVNZ/AP)

Witness Len Peneha said he saw a man dressed in black enter the mosque and then heard dozens of shots, followed by people running from the mosque in terror.

Mr Peneha, who lives next door to the mosque, said the gunman ran out of the mosque, dropped what appeared to be a semi-automatic weapon in his driveway, and fled. He said he then went into the mosque to try to help.

“I saw dead people everywhere. There were three in the hallway, at the door leading into the mosque, and people inside the mosque,” he said. “It’s unbelievable. I don’t understand how anyone could do this to these people, to anyone. It’s ridiculous.”

He said he helped about five people recover in his home, one of whom was slightly injured.

“I’ve lived next door to this mosque for about five years and the people are great, they’re very friendly,” he said. “I just don’t understand it.”

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

New Zealand Mosque Shooting
Armed police patrol outside a mosque in central Christchurch (Mark Baker/AP)

A video that was apparently livestreamed by the gunman shows the attack in horrifying detail.

The gunman spends more than two minutes inside the mosque, spraying terrified worshippers with bullets again and again, sometimes re-firing at people he has already cut down.

He then walks outside to the street, where he shoots at people on the pavement. Children’s screams can be heard in the distance as he returns to his car to get another rifle.

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. The singer bellows “I am the god of hellfire!” and the gunman drives away. The video then cuts out.

The second shooting took place at the Linwood Masjid Mosque in which at least 10 people were killed.

New Zealand Mosque Shooting
Police speak to witnesses after the terror attack in Christchurch (Mark Baker/AP)

Mark Nichols told the New Zealand Herald that he heard about five gunshots and that a Friday prayer-goer returned fire with a rifle or shotgun.

Mr Nichols said he saw two injured people being carried out on stretchers past his automotive shop and that both people appeared to be alive.

The police commissioner warned anybody who was thinking of going to a mosque anywhere in New Zealand on Friday to stay away.

The man who claimed responsibility for the shooting said he came to New Zealand only to plan and train for the attack.

He said he was not a member of any organisation, but had donated to and interacted with many nationalist groups, though he acted alone and no group ordered the attack.

He said the mosques in Christchurch and Linwood would be the targets, as would a third mosque in the town of Ashburton if he could make it there.

He said he chose New Zealand because of its location, to show that even the most remote parts of the world were not free of “mass immigration”.

New Zealand is generally considered to be a welcoming country for immigrants and refugees.

Last year, the prime minister announced that the country would boost its annual refugee quota from 1,000 to 1,500 starting in 2020.

Ms Ardern, whose party campaigned on the promise of raising the intake of refugees, dubbed the planned increase “the right thing to do”.

A cricket match between New Zealand and Bangladesh scheduled to start Saturday was cancelled after the Bangladesh team had a narrow escape.

Players and members of the team’s coaching staff were reportedly on their bus, approaching the Masjid Al Noor mosque in Hagley Park, when the shooting broke out.

Batsman Tamim Iqbal tweeted “entire team got saved from active shooters. Frightening experience and please keep us in your prayers.”

Mass shootings in New Zealand are exceedingly rare. The deadliest in modern history occurred in the small town of Aramoana in 1990, when gunman David Gray killed 13 people following a dispute with a neighbour.