CROWN HEIGHTS, Brooklyn (PIX11) — A teenage student was allegedly found in possession of a loaded handgun at a Crown Heights high school on Friday, according to officials.

The dean at the school on Carroll Street near Nostrand Avenue stopped the 17-year-old around 10 a.m. because he allegedly smelled of marijuana, according to communications among Local 237, the union representing school safety agents, shared with PIX11 News.

A search of the student in the presence of school safety agents allegedly turned up the loaded firearm, according to the union message. The NYPD confirmed that the gun was found during a search of the teen’s bag by security guards after he entered the building.

The teen, whose identity has not been released, allegedly said that he was carrying the gun for protection, according to the union communication. Charges against the teen were not immediately announced.

“Our outstanding school staff and School Safety Agents immediately recovered this item, ensuring that all students and staff are safe,” a Department of Education spokesperson said about what happened at Medgar Evers College Prep High school. “The safety and wellbeing of everyone in our schools is our absolute top priority, and dangerous weapons of any kind are not tolerated in our schools. All protocols were followed and we are working closely with NYPD regarding follow-up actions.”

The troubling find came just two days after a 16-year-old boy was caught carrying a loaded gun at a Bronx high school.

Correction: An earlier version of this article noted the wrong school in Crown Heights. The post has been updated.