The suspect -- identified as Payton Gendron of Conklin, New York -- was arraigned Saturday on one count of first-degree murder.
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 a 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 and etched the names of previous mass shooters and racial epithets on the gun he allegedly used to carry out the attack, a source familiar with the investigation told ABC News.
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 one minute after 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 chin 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 him into custody," Gramaglia said.
Erie County Sheriff John Garcia said at a news conference Sunday that the suspect is being held in isolation under suicide watch.
All 10 victims who died in the attack are Black - six females and four males ranging from age 32 to 86, law enforcement officials said. One of the wounded victims was Black while the two others were white, officials said.
The three survivors were hospitalized with non-life-threatening gunshot wounds, 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," Gramaglia said of Salter. "He went down fighting. He went towards the gunfire."
Gramaglia said the suspect fired 50 shots during the attack and had several more loaded magazine clips when he was taken into custody.
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. During a news conference Sunday afternoon, Gramaglia said at this point investigators believe the suspect "did this by himself."
Gramaglia said the evidence collected so far indicates "this is an absolute racist hate crime."
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.
Gramaglia 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," Gramaglia said. During a news conference Saturday, Mayor Brown described the shooting as "the worst nightmare any community can face."
Gendron legally purchased the Bushmaster XM-15 rifle allegedly used to carry out the attack from a firearms dealer in Endicott, New York, sources familiar with the investigation told ABC News. Investigators found the names of previous mass shooters and racial slurs etched on the gun, according to sources.
Two other weapons, a pistol and a shotgun, were found in Gendron's car, the sources said.
The Bushmaster rifle was modified by what New York Gov. Kathy Hochul called an "enhanced magazine," which is illegal in New York.
WATCH: US saw 312 gun violence incidents this weekend
The suspect also made purchases from at least one gun store in Pennsylvania, sources told ABC News. At least one of the guns Gendron had in the attack was a gift from his father, sources said.
Robert Donald, 75, owner of Vintage Firearms in Endicott, confirmed to ABC News that Gendron purchased the semi-automatic Bushmaster XM-15 from his shop a couple months ago.
On Saturday night, Donald said agents from the federal Bureau of Alcohol, Tobacco, Firearms and Explosives questioned him about the gun he sold Gendron.
"I couldn't believe it. Nobody envisions a young man doing this," Donald said. "I mean, who would do this. I've been open since 1993 and this is the first time there has been any kind of a problem."
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, who FBI officials confirmed was the 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 route through the store and allegedly wrote that he targeted the Buffalo Tops market because it is in 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 linked him to a disturbing incident at his high school.
ABC News has learned that Gendron was asked, along with other classmates, to write a paper about what he planned to do after graduation.
FBI officials confirmed that in response to the assignment, the shooter allegedly wrote that he wanted to commit a murder/suicide at the graduation of his high school in 2021.
New York State Police said in a statement Sunday that troopers responded on June 8, 2021, to Susquehanna High School in Conklin to investigate a report that a 17-year-old student had made a threatening statement. The incident resulted in no criminal charges, but the student was taken into custody for a mental health evaluation.
"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," Erie 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.
During an event Sunday at the U.S. Capitol Building honoring law enforcement officers killed in the line of duty, Biden addressed the mass shooting and described the alleged gunman as a "hate-filled soul."
"A lone gunman, armed with weapons of war and hate-filled soul, shot and killed 10 innocent people in cold blood at a grocery store on Saturday afternoon," Biden said. "Jill and I, like you, pray for the victims and their families, and a devastated community."
He said he has been receiving updates from his White House team and has been in close contact with the Justice Department.
"We must all work together to address the hate that remains a stain on the soul America," Biden said.
Biden and first lady Jill Biden will travel to Buffalo on Tuesday to grieve with the community, the White House announced on Sunday, describing the tragedy as "a senseless and horrific mass shooting."
Vice President Kamala Harris released a statement, saying, "Today our hearts are broken and we grieve for the victims of the horrific act of gun violence in Buffalo and for their families and friends."
"Law enforcement is proceeding with its investigation, but what is clear is that we are seeing an epidemic of hate across our country that has been evidenced by acts of violence and intolerance," Harris added. "We must call it out and condemn it. Racially-motivated hate crimes or acts of violent extremism are harms against all of us, and we must do everything we can to ensure that our communities are safe from such acts."
The vice president spoke briefly with reporters on the tarmac about the shooting just before boarding her plane Sunday for her trip to the United Arab Emirates, calling the tragic events "horrendous" and again referring to "an epidemic of hate."
"In our country, we have to recognize that we may very well be experiencing an epidemic of hate towards so many Americans that is wrong. It is taking on a level of violence -- in the case of what happened in Buffalo, and we've seen it in other places in our country. And we all must speak out against it," she said.
"I think we all have to know that this is something that we have to not only speak about, but we've got to do everything in our power as a nation to stop it -- to stop it. There's too much at stake that we should be working at and thinking about, not hating one another," Harris added.
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," a statement from the department read.
Secretary of Homeland Security Alejandro N. Mayorkas also released a statement, saying, "Our nation mourns the loss of life caused by the horrific shooting in Buffalo, New York. Our hearts break for the families and friends of the victims, and we stand with them and the entire Black community that was targeted by this hateful act of violence."
He said the Department of Homeland Security "continues to work closely with our partners across the country to combat violent extremism, including racially or ethnically motivated violent extremism, which continues to pose one of the most significant terrorism-related threats to the homeland. We are devoting every available resource to combat all forms of terrorism and targeted violence to keep our communities safe and secure."
"Make no mistake: when one community is targeted, we are all targeted. This country stands as one, and we will combat violent extremism as one," Mayorkas added.
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.
Tops said in a statement Sunday that it will remain closed until further notice, and it has arranged a free shuttle bus service to a nearby Tops location "to ensure our neighbors are able to meet their grocery and pharmacy needs." The supermarket chain also said it was working with Council Member Ulysees Wingo Sr. to provide free food and supplies in Buffalo via the Resource Council of WNY.
NAACP President Derrick Johnson said he and his organization are "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, Luke Barr and Mariam Khan contributed to this report.