Forty-nine people have been killed and at least 20 wounded in shootings at two mosques in Christchurch, New Zealand.
Prime Minister Jacinda Ardern described the incident as a terrorist attack and one of New Zealand's "darkest days".
A man in his late twenties was charged with murder and will appear in court on Saturday morning, police confirmed.
Two other men and one woman were detained nearby and firearms and explosive devices recovered, Police Commissioner Mike Bush said.
He said one of those detained was later released, while officers were working to determine if the other two were involved.
The attack, which came around the time people were attending the mosques for Friday prayers, was the deadliest in the nation's history.
A gunman, who identified himself in footage of an attack as a 28-year-old Australian called Brenton Tarrant, live-streamed his rampage to Facebook from a head-mounted camera. The footage showed him firing indiscriminately at men, women and children from close range inside the Al-Noor mosque.
Police called on the public not to share the "extremely distressing" footage online. Facebook said it had removed the gunman's Facebook and Instagram accounts and was working to remove any copies of the footage.
The suspect who was charged appeared to have published a document before the attack outlining his intentions and in which he espoused far right and anti-immigrant ideology.
Australian Prime Minister Scott Morrison described the man as an "extremist, right-wing" terrorist. Police Commissioner Bush confirmed that the man was not known in advance to either New Zealand or Australian security services.
New Zealand police said on Twitter that officers went to a property in the city of Dunedin in connection with the attack in Christchurch.
"It is clear that this can now only be described as a terrorist attack," Prime Minister Ardern said in a press conference. In a tweet, she said: "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."
The first report of an attack came from the Al Noor mosque in central Christchurch. Witnesses told local media they ran for their lives, and saw people bleeding on the ground outside the building.
A second mosque in the suburb of Linwood was evacuated, but there were fewer details from that site. Police also defused "a number of IEDs [explosive devices] attached to vehicles", Mr Bush said.
Armed police patrolled the streets following the shooting at the Al Noor mosque
Authorities advised all mosques in the city to shut down until further notice. Armed police were also seen at Papanui High School in Christchurch, which was cordoned off.
Mr Bush said a number of firearms had been recovered from both mosques, and explosive devices were found in a car belonging to one of the suspects.
Footage filmed by the gunman at the Al Noor mosque showed him driving up to the front door, before taking weapons from his car, entering the mosque and firing at those inside.
One unnamed survivor told TV New Zealand he saw the gunman shoot a man directly in the chest. The attacker reportedly targeted the men's prayer room in the mosque, then moved to the women's room.
"What I did was basically just waiting and praying, God please, let this guy run out of bullets," the witness said. "He came to this side, he shot this side, he went to another room and went to the ladies' section and shot them. I just heard one of the ladies has died."
A Palestinian man who asked not to be named told the AFP news agency he heard rapid gunfire and saw a man shot in the head.
"I heard three quick shots, then after about 10 seconds it started again - it must have been an automatic, no one could pull a trigger that quick," he said. "Then people started running out. Some were covered in blood."
A second mosque in the suburb of Linwood was also evacuated. The police commissioner said "multiple fatalities" were recorded at two locations.
Police advised Christchurch residents to remain off the streets and stay indoors and a lockdown was implemented at all schools in the area. The lockdown was later lifted and parents allowed to collect their children.
Brenton Tarrant identified himself in the video live-streamed on Facebook.
Social media accounts in that name were used to post a lengthy, racist document in which the author identified the mosques that were later attacked and set out anti-immigrant motivations for the attack.
Although New Zealand police said they had charged a man in his late twenties with murder, they did not identify the man.
The Bangladesh national cricket team appeared to have narrowly escaped the shooting. A reporter following the team, which was due to play New Zealand in a now-cancelled test match on Saturday, tweeted that the team had "escaped from a mosque near Hagley Park where there were active shooters".
Player Tamim Iqbal tweeted that the "entire team got saved from active shooters".
Bangladesh Cricket Board spokesman Jalal Yunus said most of the team had gone to mosque by bus and were about to go inside when the incident took place.
"They are safe. But they are mentally shocked. We have asked the team to stay confined in the hotel," he told the AFP news agency.
US President Donald Trump offered his "warmest sympathy and best wishes" to New Zealand. "The US stands by New Zealand for anything we can do. God bless all!" he wrote.
UK Prime Minister Theresa May offered her "deepest condolences to the people of New Zealand".
The Queen said she was "deeply saddened by the appalling events in Christchurch today. Prince Philip and I send our condolences".
Pope Francis offered his "heartfelt solidarity" and was "deeply saddened to learn of the injury and loss of life caused by the senseless acts of violence", Vatican Secretary of State Pietro Parolin said in a telegram.
German Chancellor Angela Merkel said she mourned "with New Zealanders for their fellow citizens who were attacked and murdered out of racist hatred while peacefully praying in their mosques".
And French President Emmanuel Macron called it an "odious attack" and said France stood "against any form of extremism".