The shooter behind the Tuesday shooting at a Texas elementary school barricaded himself into the classroom where he shot students after being pursued by law enforcement, according to officials.

Salvador Ramos, the 18-year-old shooter, entered a crowded classroom in Uvalde and indiscriminately opened fire on the students within after barring the door, officials said. Nineteen students and two teachers were killed in the shooting after being trapped in the same classroom with Ramos, they added.

The events began after Ramos shot his grandmother and crashed a vehicle while fleeing the scene, Public Safety spokesman Lt. Chris Olivarez said during an appearance on NBC's Today. Police received calls about an armed person making his way into the school.

WATCH: EMOTIONAL NBA COACH STEVE KERR BLASTS SENATE AFTER TEXAS SCHOOL SHOOTING

Once law enforcement "tried to make entry into the building, they were met with gunfire by the suspect, by the shooter," Olivarez said. "Some of those officers were shot. So at that point, they began breaking windows around the school trying to evacuate children, teachers, anybody they could, trying to get them out of that building."

Ramos was "able to make entry into a classroom, barricaded himself inside that classroom and again just began shooting numerous children and teachers that were in that classroom, having no regard for human life, just a complete, evil person by not having any regard for children," according to Olivarez. "Anyone inside that classroom, [he] just began shooting anyone that was in his way." Olivarez did not elaborate on how Ramos barred the door or how they determined that he did so.

"At that point, we had a tactical law enforcement team arrive made up of multiple federal officers, local officers, as well as state troopers that were able to make forceable entry into that classroom," Olivarez added. "They were met with gunfire as well, but they were able to shoot and kill that suspect."

CLICK HERE TO READ MORE FROM THE WASHINGTON EXAMINER

All students and teachers were killed in the same room, officials confirmed. Ramos was eventually shot and killed by an off-duty Border Patrol agent.

Funeral homes in Uvalde are offering the victims' families their services at no cost.