(BUFFALO, N.Y.) -- Ten people were killed and another three wounded when a mass shooting erupted at a supermarket in Buffalo, New York, that authorities allege was a "racially motivated hate crime" carried out by heavily armed white teenager who fired a barrage of 50 shots outside and inside the market.
An 18-year-old male suspect is in custody, police said. The shooter livestreamed the Saturday afternoon attack on social media, authorities said.
The gunman, wearing military fatigues, body armor and a tactical helmet, shot four people in the parking lot of a Tops supermarket around 2:30 p.m., three fatally. He proceeded inside the store where he was confronted by a retired Buffalo police officer working security, police said.
The guard shot and struck the suspect but without effect due to the body armor, police said.
The gunman then proceeded to shoot nine more people inside the store, police said.
Buffalo Police Commissioner Joseph Gramaglia told ABC News on Sunday that police officers arrived at the store within one minute of getting the first report of the shooting in progress and raced toward the gunfire to confront the suspect.
Gramaglia said that upon seeing the officers, the assailant placed the barrel of an assault-type rifle up to his neck and threatened to shoot himself. He said officers were able to de-escalate the situation and talked the suspect into dropping the weapon.
"He had dropped down to his knees and began taking off his tactical gear and they immediately took them into custody," Gramagilia said.
Among the 13 victims shot, 11 were Black and two were white, authorities said.
Four of the shooting victims were store employees while the rest were customers, authorities said.
The Buffalo police officer working security was among those killed, according to a law enforcement official. He was identified as Aaron Salter Jr. by Buffalo Mayor Byron Brown.
"He's a true hero," Gramagilia said of Salter. "He went down fighting. He went towards the gunfire."
Gramagilia said the suspect fired 50 shots during the attack and has several more loaded ammunition magazines when he was taken into custody.
Three victims suffered non-life-threatening gunshot wounds, authorities said.
Brown ordered flags to be lowered to half-staff at city facilities, including police stations, fire stations and Niagara Square in the heart of Buffalo.
No other suspects are outstanding, a law enforcement official said.
The suspect -- identified as Payton Gendron of Conklin, New York -- was arraigned Saturday on one count of first-degree murder and ordered held without bail, according to Erie County District Attorney John Flynn. His office is also investigating terrorism charges, he said.
The suspect traveled from a New York county several hours away to the Buffalo store, authorities said.
Gramagilia said investigators believe the suspect arrived in Buffalo on Friday.
"It seems that he had come here to scope out the area, to do a little reconnaissance work on the area, before he carried out his just evil, sickening act," Gramagilia said. During a news conference Saturday, Mayor Brown described the shooting as "the worst nightmare any community can face."
Gendron legally purchased the AR-15 assault-style rifle used in the Buffalo supermarket shooting at a gun store in his home county of Broome, New York Gov. Kathy Hochul confirmed during an interview with ABC New York City station WABC.
The rifle was modified by what Hochul called an “enhanced magazine,” which is illegal in New York, Hochul said.
The FBI is separately investigating the attack as a hate crime and as racially motivated violent extremism.
Early indications are the shooter may have possessed extremist beliefs cultivated online, law enforcement sources told ABC News.
A 180-page document believed to have been posted on the internet by Gendron before he allegedly committed the massacre is a hate-filled screed fixated on the notion of "replacement theory," a white supremacist belief that non-whites will eventually replace white people because they have higher birth rates, according to a copy viewed by ABC News.
Gendron, the purported author of the document, embraces racist and anti-Semitic tropes throughout the document. He also included photos of himself and described why he decided to carry out the attack, largely focused on replacement theory.
Investigators are looking at multiple online postings that may be associated with the shooter that include praise for South Carolina church shooter Dylann Roof and the New Zealand mosque shooter Brenton Tarrant, according to the document.
The document also includes a detailed plan for his alleged attack, stating time, place and manner. He allegedly even mapped out his planned route through the store and allegedly wrote that he targeted the Buffalo Tops market because it is a predominantly Black neighborhood, according to the document.
Gendron allegedly wrote that he understood he could be killed, but if he survived and goes to trial, he said he intends to plead guilty.
"This was pure evil," Erie County Sheriff John Garcia told reporters. "It was a straight-up racially motivated hate crime from somebody outside of our community ... coming into our community and trying to inflict evil upon us."
During an interview Sunday on ABC's "This Week" with George Stephanopoulos, Hochul said investigators probing Gendron's background have found other disturbing documents he wrote as a high school student and that he was under observation of medial authorities.
"I want to know what people knew and when they knew it and calling upon law enforcement as well as our social media platforms," Hochul said.
She added that depraved ideas fermenting on social media are "spreading like a virus" and need to be monitored and shut down.
"It has to stop, because otherwise, there’s no stopping it," Hochul said.
Hochul said she has directed the New York State Police's Hate Crimes Task Force to assist in the investigation.
A home linked to the suspect in Conklin, a town near Binghamton in Broome County, was searched by the FBI and New York State Police Saturday evening, according to law enforcement officials and eyewitnesses. Hochul confirmed during a news briefing that a home in Broome County was searched Saturday.
Authorities did not specify which social media platform the suspect used to allegedly livestream the shooting. But following the attack, the livestreaming platform Twitch said it had indefinitely suspended a user over the shooting in Buffalo.
"Twitch has a zero-tolerance policy against violence of any kind and works swiftly to respond to all incidents," a Twitch spokesperson said in a statement. "The user has been indefinitely suspended from our service, and we are taking all appropriate action, including monitoring for any accounts rebroadcasting this content."
The company said it removed the stream within two minutes of the violence starting and is monitoring Twitch for any re-streams of the content or related content.
"A horrible day in the history [of] our community," Eri County Executive Mark Poloncarz said in a statement posted on Twitter. "Like too many communities in our nation, we've been impacted by the horror [of] a mass shooting. My thoughts are about the deceased and with their families at this terrible time."
President Joe Biden has been briefed on the shooting, his press secretary said.
"He will continue to receive updates throughout the evening and tomorrow as further information develops," White House press secretary Karine Jean-Pierre said in a statement. "The president and the first lady are praying for those who have been lost and for their loved ones."
Attorney General Merrick Garland was also made aware of the incident.
“The Justice Department is investigating this matter as a hate crime and an act of racially-motivated violent extremism. The Justice Department is committed to conducting a thorough and expeditious investigation into this shooting and to seeking justice for these innocent victims," the statement from the department read.
Tops Friendly Markets said in a statement it was "shocked and saddened" by the shooting and offered condolences to the victims and their families.
"We appreciate the quick response of local law enforcement and are providing all available resources to assist authorities in the ongoing investigation," the Amherst, New York-based supermarket chain said.
NAACP President Derrick Johnson called the organization was "shattered" and "extremely angered" by the incident.
"This is absolutely devastating. Our hearts are with the community and all who have been impacted by this terrible tragedy," Johnson said. "Hate and racism have no place in America."
The Buffalo shooting prompted the New York Police Department to provide increased security at Black churches around New York City “in the event of any copycat," the NYPD said in a statement.
"While we assess there is no threat to New York City stemming from this incident," the NYPD said in its statement, "out of an abundance of caution, we have shifted counterterrorism and patrol resources to give special attention to a number of locations and areas including major houses of worship in communities of color."
ABC News' Matt Foster and Luke Barr contributed to this report.