The gunman who killed five people inside an Illinois factory Friday began shooting in the meeting in which he was fired, authorities said Saturday.

Gary Martin, 45, had at least six prior arrests and used an illegal firearm, police said.

Martin was a 15-year employee of the Henry Pratt Co. warehouse in Aurora. It’s not clear why he was being fired.

The victims were identified as Clayton Parks, Trevor Wehner, Russell Beyer, Vicente Juarez and Josh Pinkard.

Aurora Police Chief Kristen Ziman said a prior felony assault conviction in Mississippi should have barred him from owning a firearm in Illinois. She added that he had also been arrested for domestic battery issues.

Martin also wounded five cops in the Friday bloodbath before he was killed by police.

In the hours before the shooting, Martin went about his business like it was any other day, buying smokes at his local Circle K, according to a store clerk quoted by USA Today.

“He came in almost every day and bought two or three Black & Mild cigars,” said Ricardo Moreno, adding that the two would “chat about life and work.”

Neighbors said Martin was “friendly” when they’d see him in the hallway or outside playing with his drones.

“He said hi to a lot of people who came and went. I’m kind of shocked, I guess,” his next-door neighbor, Mary McKnight said, according to CNN. “I’m sad and shocked, and you kind of never know.”

Another neighbor, Jennifer White, said a bomb squad searched Martin’s apartment Friday.

Martin opened fire with a Smith and Wesson shortly after he received news he was being fired.

The shooter’s family sought “peace” as they mourned at a suburban Chicago home Friday, the Chicago Tribune reported.

“We are mourning for the victims and we are mourning for our families,” said a woman who declined to be identified but spoke on behalf of the family. “We’re worried about the other people who were killed and hurt. Our family has to mourn too because we lost one too.”

A Sunday afternoon vigil is planned for the victims at the Henry Pratt building, followed by a tribute to the Aurora Police Department at a local station, according to ABC7 Chicago.