Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A teacher who allegedly fired a gun at a Georgia high school was taken into custody Wednesday afternoon after barricading himself in a classroom for nearly an hour.

No students at Dalton High School were hurt directly in the incident or remained in danger after they were evacuated as the crisis unfolded, according to Dalton police.

The teacher — identified as Randall Davidson, 53 — initially barricaded himself in an empty classroom at about 11:30 a.m. ET as confused students tried to get in, police spokesman Bruce Frazier said at a news conference. There were then reports that a gun was fired. Davidson, a social studies teacher, surrendered after 30 to 45 minutes, police said.

Dalton High School Principal Steve Bartoo said he was called by an assistant principal and told that a teacher wasn't letting students into his classroom — that he tried to open the door but the teacher slammed it and yelled "go away" and made some "nonsensical noises.

When Bartoo go the the room with a key the teacher slammed the door again and warned he had a gun.

"I put my key in the door and again he slammed the door before I could open it and said ‘Don’t come in here, I have a gun,'" Bartoo told reporters. He said he put the school into lockdown and "it was shortly after that that I heard a gunshot."

"We thank God that nobody got hurt," Bartoo said.

A bullet had gone through an exterior window of the room, but it didn't appear Davidson was aiming at any person, Frazier added.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Randal Davidson, the teacher police say barricaded himself in the classroom at Dalton High School. via Facebook

It was unclear what led the teacher to lock himself inside the classroom.

"It certainly didn't seem like he had any intention to harm anyone," Frazier said.

Officials were trying to determine if Davidson's handgun was in the classroom while he was teaching earlier in the day or if he brought it on campus later.

An armed school resource officer is assigned to Dalton High School, which is about 90 miles north of Atlanta and has about 2,000 students, according to its website. But the resource officer was at a separate junior high when the incident started. He eventually returned and was able to convince the teacher to surrender peacefully, Assistant Police Chief and acting head of the department Cliff Cason said.

One female student who ran from the scene suffered an ankle injury, Dalton police tweeted.

One student apparently sustained an ankle injury running inside the school during the evacuation. Student is being treated by EMS at the school. — Dalton Police (@DaltonPD) February 28, 2018

Dalton police said Wednesday afternoon that Davidson has been charged with aggravated assault, carrying weapon on school grounds, terroristic threats, reckless conduct, possession of gun during commission of a crime, and disrupting public school.

Davidson is also known for doing the play-by-plays for the Dalton High School football team, according to police.

Bartoo, who's been at the school 27 years, said he’s known Davidson the whole time. He described the educator as an "Excellent teacher, very good teacher" and "well thought of in our building."

"As far as I know he was fit to be at work, and I'm not aware of any current depression,” Bartoo said.

The main entrance of Dalton High School, in Dalton, Georgia on Feb. 24, 2018. Jeff Martin / AP

The incident comes two weeks after the mass shooting at a Parkland, Florida, high school that claimed 17 lives.

President Donald Trump proposed a solution to end classroom massacres by arming some of America's teachers with concealed weapons — a suggestion that has gotten push back from educators and students across the country.

Bartoo and Cason praised school staff and students for following lock-down procedure. Classes at the high school will be canceled on Thursday and will resume on Friday, the district announced.

"Our teachers care about our kids, they love our kids, they take care of our kids, and it’s certainly shocking — it'd probably be shocking to any school principal if one of their staff members, you know, pulled a gun out in a classroom and fired it," Bartoo said.

A student at the school told NBC News in a phone interview that she was terrified. Chondi Chastain, 16, a junior, said she was in the cafeteria when a principal announced “everybody walk, don't run” and that as around 100 students exited the back of the school some students were pushing out of the doors screaming, running, crying and trying to call their parents.

She said she has Davidson for U.S. history and has been in his class since August.

"I didn't expect this," she said, describing Davidson as a nice, funny teacher who "cares about your grade and doesn't want you to fail."

“I've been shaking since I got home," Chondi said.