A California UPS worker with a stash of weapons, 20,000 rounds of ammo and body armor was arrested after cops said he threatened a mass shooting at his workplace.

Thomas Andrews, 32, of Sunnyvale, Calif., was charged with making criminal threats, evading police, drunk driving and weapons violations, Sunnyvale police said Monday.

“He alluded to a mass shooting in his text messages,” Capt. Dan Pistor told the Associated Press. “I definitely think we avoided a tragedy.”

MAN FATALLY SHOT AT ALTAR OF CALIFORNIA CATHOLIC CHURCH: REPORT

Cops said Andrews had threatened to shoot up the UPS facility in Sunnyvale in texts to his boss.

He was arrested Sunday after a car chase with police, Fox 2 San Francisco reported.

SHOOTING AT MOLSON COORS' MILWAUKEE FACILITY LEAVES 6 DEAD, INCLUDING SUSPECT, AUTHORITIES SAY

Police said with a search warrant for his home "officers located over 20,000 rounds of handgun and rifle ammunition, numerous high capacity magazines, five tactical style rifles, one shotgun, three handguns, and body armor.”

“Several tactical backpacks containing ammunition were staged at the front door of the apartment where the suspect resides,” they said.

CLICK HERE TO GET THE FOX NEWS APP

Pistor told the AP Andrews was upset with his employer, but he didn't know the specifics of those grievances.