A 15-year-old student brought a loaded gun to his Brooklyn school on Thursday morning, police said.

The 22-caliber gun was detected by scanners at the Brooklyn School for Career Development on Clermont Avenue in Fort Greene around 8:50 a.m., cops said. The gun was in the student’s backpack, they said.

advertisement | advertise on newsday

Thursday was the first day back to to school for students in the city.

The student, who has not been identified, is in custody, police said. Charges are pending.