BUFFALO, N.Y. -- A retired police officer is being praised for the valiant actions he took to protect others when a gunman opened fire on a supermarket, killing 10 people in an alleged hate crime.
Aaron Salter was working as a security guard for the Tops Friendly Market in Buffalo, New York, when a gunman shot four people in the parking lot, according to the Buffalo Police Department.
Once the shooter, outfitted in military fatigues, body armor and a tactical helmet, proceeded inside the store, Salter confronted him, shooting and striking the man, Buffalo Police Commissioner Joseph A. Gramaglia told ABC News Sunday.
MORE: Shooter fired 50 rounds in Buffalo supermarket attack, police say
But those bullets had no effect due to body armor the suspect wore, and the gunman returned fire, striking Salter, Gramaglia said.
The gunman shot nine people inside the store, livestreaming the entire massacre on social media. Salter was one of 10 people killed in the mass shooting.
Four of the shooting victims were store employees while the rest were customers, authorities said.
SEE ALSO: Buffalo community unites in grief and hope following mass shooting
While it is not clear how many more victims were saved due to Salter's actions, Gramaglia said, "We're sure he saved lives yesterday,"
"He went down fighting," Gramaglia said, describing him as a true hero. "He came in, he went towards the gunfire. He went towards the fight."
Salter retired from the police department several years ago and had been a "beloved" member of Tops as a security guard, Gramaglia said.
"He took on a responsibility to protect the customers and the employees in the store," Gramaglia said. "And he did exactly what he signed up for."
WATCH: Mother, daughter describe escaping gunfire at Buffalo store, hearing 'bodies fall'
One Tops employee, a mother of seven, told ABC News Sunday that if it hadn't been for Salter, she and her 20-year-old daughter, who was working at the register, would not have known the gunman was headed in their direction.
When she saw Salter pull out his weapon, they knew they had to run, and they both made it out alive, she said.
Buffalo police officers responded to the scene "within one minute" of Salter being shot and encountered the gunman, Gramaglia said.
The gunman then pointed the assault rifle to his neck in a threat to kill himself, but officers were able to deescalate the situation and talk him into dropping the weapon, Gramaglia said. The suspect then dropped to his knees and began taking off his tactical gear, and officers took him into custody, Gramaglia said.
Investigators from the FBI, New York State Police and other agencies revealed that the gunman -- identified as Payton Gendron of Conklin, New York -- was in the Buffalo area at least a day before the shooting to prepare for the attack.
"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.
Gendron had legally purchased the AR-15 assault-style rifle allegedly 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 on Saturday.
The gun had been modified with 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.
Among the 13 victims shot, 11 were Black and two were white, authorities said.
Buffalo Mayor Byron 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.
ABC News' Meredith Deliso and Matt Foster contributed to this report.