Forty people were killed in shootings at two mosques in central Christchurch, New Zealand, on Friday, in what Prime Minister Jacinda Ardern labeled “a terrorist attack.”

Forty-nine people were killed in shootings at two mosques in central Christchurch, New Zealand, on Friday, in a terrorist attack that Prime Minister Jacinda Ardern described as “an extraordinary and unprecedented act of violence.”

• Officials said that four people were in custody, and that a number of explosive devices were found attached to vehicles that they had stopped.

• Officials said that four people were in custody, and that a number of explosive devices were found attached to vehicles that they had stopped.

• A Muslim leader in New Zealand said the attack was especially shocking as it took place during midday Friday prayers. The police called on mosques nationally to “shut their doors” and urged people to stay away from the mosques until further notice.

• A Muslim leader in New Zealand said the attack was especially shocking as it took place around Friday prayers. The police called on mosques nationally to “shut their doors” and urged people to stay away from the mosques until further notice.

• A video and manifesto that appeared to be by a gunman involved in the shooting were posted online on the day of the attack.

• A video and manifesto that appeared to be by a gunman involved in the shooting were posted online on the day of the attack.

Shots were fired at Al Noor Mosque on Deans Avenue near Hagley Park in the center of the city, and at Linwood Mosque, about three miles away, the police said.

Shots were fired at Al Noor Mosque on Deans Avenue near Hagley Park in the center of the city, and at Linwood Mosque, about three miles away, the police said.

Ms. Ardern said in a news conference that 30 people had been killed at Al Noor Mosque and that 10 others had died at Linwood Mosque.

The country’s police commissioner, Mike Bush, said in an evening news conference that 41 people had been killed at Al Noor Mosque and seven at Linwood Mosque, and that a further victim had died at Christchurch Hospital.

David Meates, the chairman of the Canterbury District Health Board, said that 48 people were being treated for gunshot wounds at Christchurch Hospital, and that others with gunshot wounds were being treated at other health care facilities in the city.

The police said that four people, including three men and one woman, had been taken into custody. Prime Minister Scott Morrison of Australia said that one of them was Australian.

The police said that four people, including three men and one woman, had been taken into custody. Prime Minister Scott Morrison of Australia said that one of them was Australian.

Ms. Ardern described those arrested as one principal, two associates and one person not directly connected to the attacks. She said that none of them were on security watch lists.

Ms. Ardern described those arrested as one principal, two associates and one person not directly connected to the attacks. She said that none of them were on security watch lists.

Ms. Ardern, describing the shootings as a terrorist attack that was “well planned,” said that the country’s national security threat had been raised from low to high.

Mr. Bush said that a man in his late 20s had been charged with murder and would appear in Christchurch court on Saturday morning. A number of firearms were recovered from the scenes of the shootings, he said.

“There is heightened security so we can assure people of their safety,” she said.

Mr. Bush, the police commissioner, urged people not to go to mosques anywhere in New Zealand on Friday.

The country’s police commissioner, Mike Bush, urged people not to go to mosques anywhere in New Zealand on Friday.

He also urged mosques nationally to “close your doors until you hear from us again.”

He also urged mosques nationally to shut their doors, advising them to “close your doors until you hear from us again.”

Calling the situation “very serious and grave,” Mr. Bush said that the police were in the process of mobilizing all national forces.

— CHARLOTTE GRAHAM-McLAY and MEGAN SPECIA

— CHARLOTTE GRAHAM-McLAY and MEGAN SPECIA

A 17-minute video posted to social media appears to show part of the attack.

A 17-minute video posted to social media appears to show part of the attack.

The clip, which may have been taken from a helmet camera worn by a gunman, begins behind the wheel of a car. A man, whose face can occasionally be seen in the rearview mirror, drives through the streets of Christchurch before pulling up in front of the Muslim Association of Canterbury and its adjoining mosque on Dean Avenue, beside the sprawling Hagley Park.

The clip, which may have been taken from a helmet camera worn by a gunman, begins behind the wheel of a car. A man, whose face can occasionally be seen in the rearview mirror, drives through the streets of Christchurch before pulling up in front of Al Noor Mosque, beside the sprawling Hagley Park.

He then approaches the front of the mosque on foot, his weapon visible, and begins shooting at people at the entrance. What follows is a harrowing nearly two minutes of his firing on the worshipers.

He approaches the mosque on foot, his weapon visible, and begins shooting at people at the entrance. What follows is a harrowing nearly two minutes of his firing on the worshipers.

At one point, the gunman exits the mosque and fires in both directions down the sidewalk before returning to his car for another gun — which, like the others, was inscribed with numbers, symbols or messages. When he re-enters the mosque, he shoots several bodies at close range.

At one point, the gunman exits the mosque and fires in both directions down the sidewalk before returning to his car for another gun — which, like the others, was inscribed with numbers, symbols or messages. When he re-enters the mosque, he shoots several bodies at close range.

After another few minutes, he returns to his vehicle and drives away.

After another few minutes, he returns to his vehicle and drives away.

“There wasn’t even time to aim, there was so many targets,” he says at one point, as the sirens of an emergency response vehicle blare in the background.

“There wasn’t even time to aim, there was so many targets,” he says at one point, as the sirens of an emergency response vehicle blare in the background.

— MEGAN SPECIA and JASON BAILEY

— MEGAN SPECIA and JASON BAILEY

Before the shooting, someone appearing to be the gunman publicly posted links to a white nationalist manifesto on Twitter and the online forum 8chan. The 8chan post included a link to what appeared to be the gunman’s Facebook page, where he said he would also broadcast live video of the attack.

Before the shooting, someone appearing to be the gunman posted links to a white-nationalist manifesto on Twitter and the online forum 8chan. The 8chan post included a link to what appeared to be the gunman’s Facebook page, where he said he would also broadcast live video of the attack.

The Twitter posts showed weapons covered in the names of past military generals and men who have recently carried out mass shootings.

The Twitter posts showed weapons covered in the names of past military generals and men who have recently carried out mass shootings.

In his manifesto, he identified himself as a 28-year-old man born in Australia and listed his white nationalist heroes.

In his manifesto, he identified himself as a 28-year-old man born in Australia and listed his white nationalist heroes.

He described what he said had motivated him to carry out the attack, and said he had purposely used guns to stir discord in the United States over the Second Amendment’s provision on the right to bear arms.

Writing that he had purposely used guns to stir discord in the United States over the Second Amendment’s provision on the right to bear arms, he also declared himself a fascist. “For once, the person that will be called a fascist, is an actual fascist,” he wrote.

He also declared himself a fascist. “For once, the person that will be called a fascist, is an actual fascist,” he wrote in the manifesto, adding that China’s “political and social values” were closest to his own.

— DANIEL VICTOR and TIFFANY MAY

— DANIEL VICTOR and TIFFANY MAY

Felix Kjellberg, a polarizing Youtube celebrity known as PewDiePie, distanced himself from the attacks after the man who filmed himself shooting victims at a mosque encouraged viewers to “subscribe to PewDiePie” in a video livestream.

Felix Kjellberg, a polarizing YouTube celebrity known as PewDiePie, distanced himself from the attacks after the man who filmed himself shooting victims at a mosque encouraged viewers to “subscribe to PewDiePie” in a video livestream.

“I feel absolutely sickened having my name uttered by this person,” Mr. Kjellberg, a Swede, said on Twitter. “My heart and thoughts go out to the victims, families and everyone affected by this tragedy.”

“I feel absolutely sickened having my name uttered by this person,” Mr. Kjellberg, a Swede, said on Twitter.

Mr. Kjellberg has courted controversy by performing anti-Semitic gestures, which he calls satirical, in his videos. He has a following of 89 million subscribers, including alt-right and white supremacist accounts.

Mr. Kjellberg has courted controversy by performing anti-Semitic gestures, which he calls satirical, in his videos. He has a following of 89 million subscribers.

— TIFFANY MAY

— TIFFANY MAY

Over the last 18 months, tech companies have promised to put stronger safeguards in place to ensure that violent content is not distributed through their sites, especially during breaking news events.

Over the last 18 months, tech companies have promised stronger safeguards to ensure that violent content is not distributed through their sites. But those new safeguards were not enough to stop the posting of a video and manifesto believed related to Friday’s shooting.

But those new safeguards were not enough to stop the posting of a video and manifesto believed related to Friday’s shooting across various social media channels.

A 17-minute video that included graphic footage apparently of the shooting could be found on Facebook, YouTube, Twitter and Instagram more than an hour after being posted. While Facebook and Twitter took down pages thought to be linked to the gunman, the posted content was spread rapidly through other accounts.

A 17-minute video that included graphic footage apparently of the shooting could be found on Facebook, YouTube, Twitter and Instagram more than an hour after being posted. While both Facebook and Twitter took down pages thought to be linked to a gunman in the attack, the content that had been posted on them was already spreading rapidly through other accounts.

In order to evade detection, people appeared to be cropping the video or posting the text of the manifesto as an image — both of which are techniques used to evade automated systems that find and delete content.

Dozens of versions of the video could be found through a quick search of words and names linked to a suspected gunman.

Social media companies have heavily invested in those systems, with Facebook reporting last year that more than 99 percent of terrorism content by the Islamic State and Al Qaeda was found and removed through artificial intelligence.

The country’s police commissioner, Mike Bush, said the social media postings “shouldn’t be in the public domain.”

A Facebook spokeswoman offered condolences to the victims and said the company was “removing any praise or support for the crime and the shooter or shooters as soon as we’re aware.”

In order to evade detection, people appeared to be cropping the video or posting the text of the manifesto as an image — both of which are techniques used to evade automated systems put into place by social media channels to automatically find and delete content.

Social media companies largely rely on artificial intelligence to automatically find and remove banned content. The companies have heavily invested in those systems, with Facebook reporting last year that more than 99 percent of terrorism content by the Islamic State and Al Qaeda was found and removed through artificial intelligence.

A Facebook spokeswoman offered condolences to the victims and said the company was working to stop the spread of any content in support of the attack.

“Police alerted us to a video on Facebook shortly after the livestream commenced and we quickly removed both the shooter’s Facebook and Instagram accounts and the video,” said Mia Garlick of Facebook New Zealand.

She added that the company was “also removing any praise or support for the crime and the shooter or shooters as soon as we’re aware.”

— SHEERA FRENKEL and DANIEL VICTOR

— SHEERA FRENKEL and DANIEL VICTOR

Moustafa Farouk, a spokesman for the Federation of Islamic Associations of New Zealand, said it was especially shocking for Muslims that the attack occurred during midday Friday prayers.

Moustafa Farouk, a spokesman for the Federation of Islamic Associations of New Zealand, said it was especially shocking that the attack occurred around Friday prayers.

“Its Friday, when we normally congregate for our prayers, so no one ever thought this would happen,” Mr. Farouk said in a telephone interview.

Mr. Farouk, who said in a telephone interview that he was on his way to Christchurch to meet with Muslims there, said he had never imagined that an attack of this kind could happen in New Zealand.

Mr. Farouk, who said he was on his way to Christchurch to meet with Muslims there, said he had never imagined that an attack of this kind could happen in New Zealand, which he described as a country with a “good reputation.”

“It’s one of the most peaceful countries in the world,” he added, although he said that “this kind of random act of violence will affect that image.”

“It’s one of the most peaceful countries in the world,” he added, although he said that “this kind of random act of violence will affect that image.”

— MEGAN SPECIA

— MEGAN SPECIA

Ms. Ardern called Friday “one of New Zealand’s darkest days.”

Ms. Ardern called Friday “one of New Zealand’s darkest days.”

“What has happened here is an extraordinary and unprecedented act of violence,” the prime minister said at a news conference in New Plymouth, describing the shooting as “an act that has absolutely no place in New Zealand.”

“What has happened here is an extraordinary and unprecedented act of violence,” the prime minister said at a news conference in New Plymouth, describing the shooting as “an act that has absolutely no place in New Zealand.”

“Many of those affected may be migrants to New Zealand — they may even be refugees here,” Ms. Ardern said of the victims. “They are one of us. The person who has perpetrated these acts is not.”

“Many of those affected may be migrants to New Zealand — they may even be refugees here,” Ms. Ardern said of the victims. “They are one of us. The person who has perpetrated these acts is not.”

“My thoughts, and I’m sure the thoughts of all New Zealanders, are with those affected and their families,” the prime minister added.

— CHARLOTTE GRAHAM McLAY

— CHARLOTTE GRAHAM McLAY

Aman Singh, who works at a convenience store close to the Deans Avenue mosque, said he had heard the gunshots on Friday afternoon, and that shortly afterward people had streamed past the shop, bloody and crying.

Aman Singh, who works at a convenience store close to the Deans Avenue mosque, said he had heard the gunshots on Friday afternoon, and that shortly afterward people had streamed past the shop, bloody and crying.

Mr. Singh, 26, said he knew several people who worshiped at the mosque.

Mr. Singh, 26, said he knew several people who worshiped at the mosque.

“My really good friend goes there,” he said, adding that he had not been able to confirm the friend’s whereabouts on Friday afternoon.

“My really good friend goes there,” he said, adding that he had not been able to confirm the friend’s whereabouts on Friday afternoon.

Mr. Singh, who moved to New Zealand from India four and a half years ago, was still hiding in the store with his wife, as the police had yet to arrive at their location.

Mr. Singh, who moved to New Zealand from India four and a half years ago, was still hiding in the store with his wife, as the police had yet to arrive at their location.

He said they would be unlikely to be able to return home anyway, as their street was cordoned off because it was close to the Linwood Mosque that was also attacked.

He said they would be unlikely to be able to return home anyway, as their street was cordoned off because it was close to the Linwood Mosque that was also attacked.

— CHARLOTTE GRAHAM-McLAY

— CHARLOTTE GRAHAM-McLAY

Trevor Mallard, a Labour party lawmaker and the speaker of the house, said he was evacuated from Canterbury University, where he was with several other lawmakers to attend a student protest over climate change that is part of a worldwide movement.

Mr. Mallard described the shootings as “absolutely awful and unfair,” and he urged New Zealanders against “any sort of knee-jerk response.”

“Security is constantly under review, and this will be factored in,” he said, although he added that he did not expect “massive changes in the longer term” to security at Parliament.

— CHARLOTTE GRAHAM-McLAY

Murders are rare in New Zealand, and gun homicides even rarer. There were 35 murders countrywide in 2017. And since 2007, gun homicides have been in the single digits each year except 2009, when there were 11.

Murders are rare in New Zealand, and gun homicides even rarer. There were 35 murders countrywide in 2017. And since 2007, gun homicides have been in the single digits each year except 2009, when there were 11.

But there are plenty of guns.

But there are plenty of guns.

There were 1.2 million registered firearms in the country of 4.6 million people in 2017, according to the Small Arms Survey, a Swiss nonprofit.

There were 1.2 million registered firearms in the country of 4.6 million people in 2017, according to the Small Arms Survey, a Swiss nonprofit.

A mass shooting in the New Zealand in 1990 — when a man killed 13 people, including two 6-year-olds, after a dispute with his neighbor in the seaside town of Aramoana — led directly to tightened gun laws, including restrictions on “military style semiautomatic weapons.”

A mass shooting in the New Zealand in 1990 — when a man killed 13 people, including two 6-year-olds, after a dispute with his neighbor in the seaside town of Aramoana — led directly to tightened gun laws, including restrictions on “military style semiautomatic weapons.”

Gun owners must be licensed, a process that includes a review of criminal activity and mental health, attendance at a safety program, an explanation of how the gun would be used, a residence visit to ensure secure storage, and testimonials from relatives and friends.

Gun owners must be licensed, a process that includes a review of criminal activity and mental health, attendance at a safety program, an explanation of how the gun would be used, a residence visit to ensure secure storage, and testimonials from relatives and friends.

— DANIEL VICTOR

— DANIEL VICTOR

One of the members of Bangladesh’s national cricket team, who said he and other teammates had fled the mosque as the shooting began, tweeted about his escape.

The cricketer, Mushfiqur Rahim, thanked god for his safety and wrote: “we r extremely lucky...never want to see this things happen again....pray for us.”

The team later confirmed on its own Twitter account that all members of the national team were safe, adding that “The Bangladesh Cricket Board (BCB) is in constant contact with the players and team management.”