Earl Williams is charged with criminal possession of a weapon.
Exclusive video shows Williams being led out of the school in handcuffs, with officers set to transport him to the 48th Precinct.
The weapon was in a grocery-store type plastic bag spotted by a school safety officer, according to the New York City Police Department.
Williams, a senior at Providing Urban Learners Success in Education High School, arrived at the front security desk where there are no metal detectors, and asked the school safety officer, "Can you hold my books here, I'll be back by third period."
Police said he placed the plastic bag on the ground and walked away. The school safety agent picked up the bag, noticed it was unusually heavy and discovered the loaded gun. The suspect was found outside smoking a cigarette.
The alternative high school in the Bronx at 560 East 179th St.
The city education department confirmed that "the NYPD immediately responded to this serious incident."
"We are working in close partnership with them as they conduct an investigation. The weapon was swiftly and safely confiscated, and all students and staff are safe. Nothing is more important than the safety of every school building and there is zero tolerance for weapons of any kind in schools," it said in a statement.
There are no metal detectors in this school. null