The main suspect accused of carrying out a massacre at two New Zealand mosques on Friday was described by officials as a "right-wing extremist terrorist," and appeared to post a lengthy manifesto before the attack detailing his white-supremacist worldview.
Authorities charged a 28-year-old Australian national with murder in the shooting deaths of at least 49 people during Friday prayers in the city of Christchurch.
Police sources told NBC News' Australian partner Channel 7 that the suspect's name is Brenton Tarrant.
Three other people have been detained although authorities said it was unclear how they related to the incident. None of the four were on any terrorism watchlists, officials said.
Although not confirmed as the suspect's by authorities, a 74-page manifesto titled "The Great Replacement" was posted online beforehand and matched several known details about the suspect and the attack.
It contains a sprawling array of anti-immigrant, anti-Muslim and white-supremacist references, repeating common far-right talking points, and refers to President Donald Trump.
"Were/are you a supporter of Donald Trump?" the author of the manifesto wrote. "As a symbol of renewed white identity and common purpose? Sure. As a policy maker and leader? Dear god no."
It also condemns attempts to restrict firearms in the U.S. and pledges to start an American race war.
"This conflict over the 2nd amendment and the attempted removal of firearms rights will ultimately result in a civil war that will eventually balkanize the US along political, cultural and, most importantly, racial lines," the manifesto said.
The author said he had been planning the attack for two years and moved from Australia to New Zealand to plan and train. Though New Zealand was not the original target for the assault, he said he chose it because of its image as one of the safest countries in the world.
Paul Spoonley, a professor at New Zealand's Massey University, said that the far-right has "been building for some time but it's still quite a minor part of the political spectrum in New Zealand."
Speaking to Britain's Sky News, he said: "Somehow we thought we were exempt from it but that innocence has been completely blown away today."
Rather than focusing on only domestic grievances, white-supremacist nationalists are increasingly taking their cues from incidents around the world, championing international supporters of their cause and condemning what they see as injustices around the world, Spoonley added.
The author of the Christchurch manifesto also posted it to the fringe message board 8chan. Many of 8chan's members celebrated the attack and lauded the manifesto's references to niche memes and in-jokes.
Anti-immigrant far-right extremism has a long history in Australia and in recent years its focus has shifted to opposing Muslims, according to Mark Briskey, a senior lecturer in criminology at Murdoch University in Perth.
These views have seeped into the political mainstream, echoed and amplified by public figures such as Australian Sen. Fraser Anning who last year invoked the term "final solution" in a call to restrict Muslim immigration.
Briskey said such messages "give a permission for people who may be attracted to this narrative to undertake further acts of vilification against Muslims, and in the extreme, with violence."
The manifesto posted before the New Zealand attack referred to the victims of a terror attack in Stockholm and racial tensions in the Balkans.
The author says he was inspired by Charleston church shooter Dylann Roof as well as Anders Behring Breivik, the far-right terrorist who killed 77 people in Norway in 2011.
He says he aims to spark a civil war in the U.S. along divisions relating to gun rights and race.
Its author also says he is a supporter of President Donald Trump as what he describes as a symbol of white identity, but he adds that he dislikes Trump as a policymaker and a leader.
Hours after the attack, the president condemned the killings.
Although not confirmed by officials, the suspect appeared to film the attack on a head-mounted camera, live streaming the 17-minute incident to Facebook. The footage has since been taken down.
It shows him driving in a car while listening to a Serbian folk song about Radovan Karadzic, the Bosnian Serb political leader convicted of war crimes including the 1995 genocide of Muslims in Srebrenica.
He then gets out of the car, retrieves a weapon from the trunk, and walks through the mosque firing at the worshippers inside for several minutes.
He also appears to encourage viewers to subscribe to PewDiePie, one of the world's best known YouTubers who has used racist language in the past and been accused of anti-Semitism.
PewDiePie, real name Felix Kjellberg, tweeted Friday that he felt "absolutely sickened having my name uttered by this person."
The video, and several images posted to social media that appear to tally with the incident, shows weapons scrawled with writing about Serbian knights who fought Ottoman Turks and Bosnians in the Middle Ages.
The manifesto condemns the U.S.-led bombing of Yugoslavia, which began 20 years ago next week, saying that NATO "fought beside Muslims and slaughtered Christian Europeans attempting to remove these Islamic occupiers from Europe."
NBC News spoke with a woman who said she went to high school with Tarrant in Grafton, New South Wales, Australia.
"He was not very popular and was teased a lot," she said, asking to remain anonymous. "He was picked on throughout school. He was always strange."
The woman said Tarrant worked at a local gym, which was also reported by Australian public broadcaster ABC.
"He was a very dedicated personal trainer," gym manager Tracey Gray told ABC. "He worked in our program that offered free training to kids in the community, and he was very passionate about that."