A 16-year-old student brought a loaded handgun — and six bags of weed stuffed inside of his socks — to his Manhattan high school that’s just steps away from Police HeadquartersFriday morning, authorities said.

Keanu Lopez was pulled aside by a teacher about 9 a.m. after a fellow student at Murry Bergtraum HS said the suspect smelled of weed, cops said.

School safety agents from the Pearl Street school, along with a dean, stepped in to search the students backpack. They uncovered a loaded .380 Taurus handgun.

Police responded and located the hidden marijuana. Lopez, of Alphabet City, was charged with criminal possession of a weapon and unlawful possession of marijuana.