CHAMPAIGN, Ill. (WCIA) — A 16-year-old Centennial High School student is facing a gun charge after prosecutors said he brought a loaded gun to school on Thursday.

The student is charged with one count of unlawful use of a weapon, a Class 3 felony. After hearing evidence on Friday, Judge Roger Webber ordered the student to be detained at the Champaign County Juvenile Detention Center, saying he is a risk to the public.

In a letter to parents on Thursday, Champaign School District officials said the metal detectors at Centennial sounded as the student walked through them at the entrance to the building. School administrators searched the student’s backpack and discovered inside a .38 caliber pistol loaded with three rounds.

Prosecutors said the student tried to run but was caught and arrested. They added that the student told police officers he carried the gun for protection but refused to tell them where he got it from.

Another hearing is scheduled for next Wednesday. Prosecutors said the student does not have any prior criminal history.

If convicted, he can be incarcerated for two to five years or until his 21st birthday in the Illinois Department of Juvenile Justice.