HOMESTEAD (CBSMiami) – A student from Redland Middle School was airlifted today after police say he was shot in class. Witnesses said another student had a gun in his backpack and it went off.

Pablo Sanchez said the shooting happened during his sixth grade history class.

READ MORE: Convicted Killer Dayonte Resiles Sentenced To Life In Murder Of Jill Halliburton Su

“He had a gun in his bookbag and he just dropped his bookbag and all you hear is a sudden boom,” said Sanchez. He said the bullet hit a classmate in the leg. “I took off my shirt and put it around his leg and put pressure.” Sanchez said he learned that technique by watching movies.

The student, who was shot, was airlifted to Miami Children’s Hospital in stable condition.

READ MORE: Coral Springs Police: 3 Separate Crime Scene Tied To One Suspect

The school was put on lockdown.

“Code Red all the doors were locked. None of the kids were able to leave,” said Marc Diaz, a student. His mom Cheryl added, “It’s very scary for a parent to be on the outside and not know what’s going on with your child.”

School Police continues to investigate the shooting.

Chief Ian Moffett, whose first day on the job was Friday said, “Right now it appears the firearm was an accidental discharge in the classroom.”

MORE NEWS: School Bus Driver Accused Of Molesting 7-Year-Old Girl In Mami-Dade

Police questioned the student who brought the gun to school. On Friday night a child was led from a Schools Police car into the Juvenile Assessment Center.