Authorities said a shooting at a South Whittier high school was thwarted last week after a security guard overheard a student making a threat, which led deputies to a stockpile of weapons at the teenager’s home.

Los Angeles County Sheriff Jim McDonnell said Wednesday the deputies seized two AR-15s, two handguns — a Colt .45 and a Colt .38 — 90 high-capacity magazines and ammunition.

The 17-year-old El Camino High School student, arrested Friday on suspicion of making criminal threats, did not have a weapon when he was confronted by the security guard.

McDonnell did not name the teen because he is a minor.

The teen allegedly said he was going to shoot up the school sometime in next three weeks, the sheriff said at the Hall of Justice in downtown Los Angeles. He also has an extensive disciplinary record, McDonnell said.

The threat came two days after the shooting at Stoneman Douglas High School in Parkland, Florida, that left 17 people dead.

“Any time we can get a chance to prevent something like that from happening, we are very relieved,” McDonnell said.

Deputies on Tuesday also arrested one of the teen’s brothers, 28-year-old Daniel Eriberto Barcenas, on suspicion of multiple weapons charges. An Army veteran, Barcenas claimed he got the guns while stationed in Texas, according to Deputy Martin Maciel.

“The suspect said he purchased them legally,” Maciel said.

Maciel was one of the deputies who arrested the teen and searched the home. He said they found various kinds of ammunition in the boy’s room, one handgun in the hallway with two loaded magazines nearby and the three other firearms in a container in the garage which did not have a door.

“Everything was accessible,” Maciel said, adding that a bystander can walk in and take the weapons.

There were locks on the container, but there was also a bolt cutter nearby, he said.

The parents were at work when deputies searched the home Friday, Maciel said, adding that one of the rifles was registered to a third brother. One of the AR-15s, however, was not compliant with California law.

McDonnell called the school safety officer, Marino Chavez, a hero for what he did.

“I’m not a hero. I’m just doing my job everyday,” said Chavez, who has worked for the Norwalk-La Mirada Unified for two decades.

District officials said the student was upset with a teacher. He had brought headphones to school, and students are not allowed to have electronic devices out during class time, district officials said. They did not say when this occurred.

Chavez said the teen wasn’t allowed to go to his fifth period class on Friday because of the discovery of the headphones earlier.

After lunch break, when students were returning to class, Chavez said he heard the teen tell someone that within three weeks, there would be a school shooting.

Chavez decided to approach the teen. He told the boy he could not say that at school.

“He did say he was kidding and did not mean it,” Chavez said.

The officer took the teen to the office and notified the sheriff’s Norwalk station.

McDonnell said this was the second threat at El Camino High, a continuation high school at 14625 Keese Drive in unincorporated South Whittier, in a week.

He said the day before, a teen told a parent about wanting a school administrator dead. That student’s house was searched, but nothing was found, according to McDonnell. He did not disclose any further details about this other threat.

The 17-year-old student from the second incident, is in custody, McDonnell said.

The boy’s brother, Barcenas, was booked Tuesday at the sheriff’s Norwalk Station on suspicion of possession of an assault weapon, importing high-capacity magazines, possession of high-capacity magazine, not having weapons properly secured, and failure to register a personal handgun.

As of Wednesday afternoon, Batcenas remains in custody at the Norwalk Station jail with bail set at $108,000. He is scheduled to be arraigned Thursday at Bellflower Superior Court.

City News Service contributed to this report.