Newly released video shows the moment an Oklahoma high school principal confronted and tackled a gunman after he opened fire inside the school.

The footage shows Pauls Valley High School Principal Kirk Moore confronting the suspect — identified as 20-year-old former student Victor Hawkins — after he walked into the building on April 7.

Moore was shot in the leg during the confrontation and was airlifted to a hospital in stable condition, authorities said.

The video also shows someone opening a door and allowing the suspected shooter into the building.

The Oklahoma State Bureau of Investigation (OSBI) told Columbine school shooting and told investigators he "wanted to conduct his own school shooting like the Columbine shooters did."

After entering the school, Hawkins allegedly pointed a gun and yelled for people to "get on the ground," KFOR reported.

He then pointed a gun at a student and attempted to fire, but the weapon malfunctioned, according to the affidavit.

Hawkins attempted to clear the malfunction before later firing at another student, who raised his hands and pleaded not to be shot, the affidavit states.

According to investigators, Hawkins lowered his weapon and told the students to leave.

The OSBI said Moore and school staff acted quickly to stop the attack.

"The principal of the school had noticed that an adult male subject, 20 years old, had stepped foot into the school with a gun," OSBI spokesperson Hunter McKee told KOCO-TV. "When the principal noticed this, he quickly stepped in, as well as other staff. The subject was able to fire multiple rounds, where the principal was hurt, but no one else was."

"The actions of the staff and the principal stepping in as soon as they saw a subject with a firearm saved lives today," McKee added.

Fox News Digital's Stephen Sorace contributed to this report.