No one was injured in the shooting at Oakland High, but the bullet ricocheted and came close to hitting another student in the leg, witnesses told district officials.

Receive the latest local updates in your inbox

The student's name has not been released because he is not yet 18 years old. The charges include gun possession and the discharge of a firearm, Alameda County District Attorney's Office spokeswoman Teresa Drenick said.

A student at Oakland High School appeared in juvenile court today to answer to four felony charges stemming from the accidental discharge of a gun he allegedly brought to school on Friday, a district attorney's spokeswoman said.

The student's name has not been released because he is not yet 18 years old. The charges include gun possession and the discharge of a firearm, Alameda County District Attorney's Office spokeswoman Teresa Drenick said.

Students were in class during the last period at around 3 p.m. when the teacher heard a loud noise that she thought was a firecracker, Oakland Unified School District spokesman Troy Flint said.

The 10th-grade student approached the teacher, pleading with her not to call anyone to report the noise, fearful that he would get in trouble or even go to jail, Flint said.

At that point, Flint said, it became clear to the teacher that a gun had been fired.

No one was injured in the shooting, but the bullet ricocheted off a partition in the classroom and came close to hitting another student in the leg, witnesses told district officials, according to Flint.

The student remained in the classroom, agitated, while the teacher tried to calm him down, Flint said.

She had asked a student aide to let the main office know what had happened, but she did not want to try and call herself, as the student was armed and upset, Flint said.

But the aide, who was in the classroom, did not make the call, Flint said. When the last bell rang, all the students, including the shooter, left the classroom.

The teacher contacted school administrators, who called school district police. Police found the student outside of the campus and took him into custody.

The gun was not recovered and the student was taken to juvenile hall.

The parents of Oakland High School students were contacted to alert them to the incident.