A 12-year-old in Iowa stood face-to-face with his teacher, pointing a loaded gun at the instructor's face, authorities said.

The young boy, who is not being named by The Washington Post because he is a minor, had taken the gun to class one morning last month at North Scott Junior High School in Eldridge, Iowa, and told the other children to drop to the ground, according to court documents cited by the Quad-City Times. Then he took aim at his teacher, and pulled the trigger, according to the documents.

But the gun did not fire — and the teacher was not shot — because the safety was on, according to the court documents.

The boy appeared in juvenile court Monday on charges including attempted murder and having a weapon on campus, according to ABC affiliate WQAD. He is being held at the Scott County Juvenile Detention Center, according to the Quad-City Times. Next month, a judge will determine whether the case will be moved to adult court.

Steve Hanna, the boy's attorney, said he could not comment on the case but noted that “some of these allegations are very much exaggerated or amplified."

Early on the morning of Aug. 31, police officers responded to a call about a student with a gun at North Scott Junior High and took the child into custody, according to a statement from the Eldridge Police Department. Investigators discovered a loaded .22-caliber handgun at the scene, and the school was placed on lockdown during an investigation into the incident, authorities said at the time.

"We want all of you to know that North Scott Junior High is on lockdown at this time,” school administrators said in an alert to parents. “Everyone is safe and we ask you please not come to school or call as we process the situation with students and staff. We did have a student bring a gun to the junior high. The student is in custody and the gun has been secured."

After the incident, one student's mother, Amy Wheeler, told the Quad-City Times that she started “freaking out” when she got a call about what had happened.

“It’s a crazy world out here,” Wheeler said.

Eldridge police Chief David Kopatich and North Scott Superintendent Joe Stutting said in a joint statement last week that in response to the incident, district officials implemented a safety plan.

It's still unclear where the boy got the gun or why he apparently took it to school and tried to shoot a teacher, but the teacher is being credited with helping to prevent another tragic school shooting.

Authorities said that when the gun failed to fire, the teacher wrestled the weapon from the boy, according to the Quad-City Times.

"The teacher in the room — the decisions that she made — made all the difference in the world,” Stutting, the superintendent, told The Washington Post. He also praised the middle-school staff members for how they handled the situation, saying that under the circumstances, it was “the best outcome you could have."

According to the Quad-City Times:

In a motion arguing for his release, the boy’s attorneys said all weapons have been removed from his home, the family is seeking mental health treatment and the boy is to be home-schooled by his stay-at-home mother following his expulsion from school. The defense attorneys also suggested the court could place the boy on GPS monitoring as the case moves forward.

State laws allow for juvenile court proceedings to be held behind closed doors. But the prosecuting attorney in Scott County has asked the court to try the boy as a youthful offender, which means the trial proceedings would happen in adult court if the judge approves. If convicted as a youthful offender, the boy would be supervised by the juvenile court system until his 18th birthday, then be sentenced in adult court.

A spokesman for the Scott County attorney's office said that if the boy's case is not moved to adult court, his trial will begin Oct. 26 in juvenile court.

Read more:

‘The gun’s not in the closet’

More than 215,000 students have experienced gun violence at school since Columbine

No, there haven’t been 18 school shootings in 2018. That number is flat wrong.