A file photo of Wilson High School.

The 18-year-old student charged with bringing a loaded handgun to Wilson High School last week told detectives he had the firearm because he needed protection while selling drugs, according to a search warrant.

Campus officials discovered the gun on April 4 after a teacher found the student, Erick Alvarez, researching guns on a school computer twice in three days, according to the warrant, which was filed publicly in Long Beach Superior Court April 5.

When the dean of students pulled Alvarez out of class to question him, they asked him if he had “anything he should not have” on him, police wrote in the warrant.

In response, Alvarez put his hands to his face and let out a despairing expletive, according to the warrant.

A school resource officer then patted Alvarez down, finding a 9 mm handgun loaded with 12 bullets in his waistband, according to the warrant. It goes on to say that the officer searched the rest of Alvarez’s property and found 10 tablets of Xanax and seven vials of concentrated cannabis distillate—or cannabis oil extract commonly used in vape pens—as well as his cell phone.

Alvarez was arrested and booked in the Long Beach Jail, where he told detectives that he needed a gun for protection while he sells drugs, according to the warrant. Police wrote he told detectives he had more cannabis and Xanax tablets at his home in South Wrigley inside a safe. He told them where the safe was and gave them the key to it, police wrote.

Student with loaded gun arrested at Wilson High School, police say

However, according to the warrant, investigators only seized $50 in cash, one 40-caliber bullet and clear plastic baggies at the home.

Reached by the Post, Alvarez said he only told detectives that he sold drugs to “get them off my back” because they were telling him they could put him in jail for life. He said he carried the gun onto campus because he was being bullied and had been jumped by gang members who went to his school.

“They would follow me after school. They tried to rob me more than three times,” Alvarez said.

When he initially reported it to school officials, he said they made him a safety plan that involved staff members walking him to class every day, but the staffers would often be late, and he was still having problems with the other students.

He said he found a gun behind a trash can in Veterans Park and, given what he was dealing with, decided to keep it.

“I thought I would use it for protection,” he said.

Long Beach Unified School District spokesman Chris Eftychiou declined to discuss Alvarez’s case specifically, but he said the district does sometimes give students safety plans that can involve walking them to class.

Alvarez is out of custody on $50,000 bail and is set to be arraigned on May 2. The district previously said Alvarez would not be returning to Wilson.

Valerie Osier is the Social Media & Newsletter Manager for the Long Beach Post. Reach her at [email protected] or on Twitter @ValerieOsier