The disgruntled worker who killed five people in Aurora, Ill., last week after being fired had passed two gun background checks five years ago, despite a criminal record that should have prevented him from possessing a firearm, Fox News has found.

The first check allowed Gary Martin to acquire an Illinois Firearm Owner's Identification card, or FOID card, to possess a weapon. The second allowed Martin to purchase a Smith and Wesson .40-caliber handgun from a local dealer in 2014.

Neither check uncovered Martin’s 1995 felony conviction in Mississippi for aggravated assault.

“I don’t know exactly what happened within the Illinois State Police with respect to these background checks -- whether it was simple human error or if they just didn’t do all the checks -- but these mistakes involving Martin occurred at the same time there was a lot of pressure on the police to keep up with the huge backlog that they had in issuing the FOID cards because of budget cuts,” said John Lott, a Fox News columnist and founder of the Crime Prevention Research Center.

AURORA SHOOTING VICTIM TEXTED HIS WIFE DURING RAMPAGE: ‘I LOVE YOU, I’VE BEEN SHOT AT WORK’

“I know that the state police felt that they had an almost impossible job to keep up with the ever growing number of applications for FOID cards and the increased gun sales at the same time that they were facing their budget being cut in half,” he said.

Martin’s conviction was finally discovered when he underwent a third background check for a concealed carry permit he sought five days after the purchase of the Smith and Wesson.

As a result, his concealed carry permit application was rejected, his FOID card was revoked and he was sent a letter notifying him to voluntarily relinquish the gun to either local law enforcement or the holder of a valid FOID card, which he never did. The Illinois State Police said in a statement Monday that local law enforcement could have petitioned a judge to issue a search warrant for the FOID card and any weapons in Martin's possession. However, state law does not require them to do so.

The Illinois State Police said it had revoked 10,818 FOID cards in 2018 alone. In most cases, a form confirming that a gun owner has surrendered his or her weapon to local law enforcement is not returned to state police.

Martin, 45, was killed in a shootout with officers Friday, ending a deadly rampage with the Smith and Wesson, which was equipped with a laser, at the Henry Pratt warehouse. Five officers were also wounded in the attack.

The victims of the shooting included the plant manager and a human resources intern on his first day on the job.

The Mississippi conviction resulted in a five-year prison sentence for Martin, who served less than three years, The Washington Post reported.

Martin pleaded guilty to abusing a former girlfriend, at one point hitting her with a baseball bat and stabbing her with a knife, according to the paper.

AURORA SHOOTER OPENED FIRE AT TERMINATION MEETING; ONE VICTIM WAS HR INTERN ON FIRST DAY

On Saturday, Aurora Police Chief Kristin Ziman told a news conference the conviction would not necessarily have shown up on a criminal background check conducted for a FOID card. She did not elaborate.

But Lott says that isn’t true.

He said the check for the FOID card would have entailed running Martin’s name through the FBI’s National Instant Criminal Background Check System.

“If his name was entered correctly it would pull up his criminal background,” Lott said.

The background check Martin underwent for the concealed carry permit used digital fingerprinting, which wasn’t used during the background checks for the FOID card and the gun purchase, Ziman said.

CLICK HERE TO GET THE FOX NEWS APP

Still, Lott said, that wouldn’t explain why Martin’s conviction was not flagged on either of those background checks.

Fox News' Samuel Chamberlain contributed to this report.