Witnesses said that loved ones and onlookers anxiously waiting outside Robb Elementary School on Tuesday as the gunman was inside shooting teachers and students urged police who were outside the school to go in and try to stop the shooter.

Some also suggested they take it upon themselves to attempt to overpower the gunman.

People mourn following the Texas School Shooting

Joseph Avila prays while holding flowers honoring the victims killed in Tuesday's shooting at Robb Elementary School in Uvalde, Texas, Wednesday, May 25, 2022. (AP Photo/Jae C. Hong)

Texas Department of Public Safety Director Steve McCraw said the gunman could have been in the school for 40 minutes to an hour.

"Go in there! Go in there!" a woman shouted to officers soon after the shooting happened, witness Juan Carranza, 24, said. He lives across the street from the school. "There were more of them. There was just one of him," he said.

TEXAS SCHOOL SHOOTING: LIVE UPDATES 

But he said the officers stayed outside.

Javier Cazares raced to the school after hearing about the shooting because his daughter went to school there.

He said he suggested a group of civilians "rush in because the cops aren’t doing anything like they are supposed to. More could have been done. They were unprepared."

His daughter, Jacklyn Cazares, died in the attack.

TEXAS SCHOOL SHOOTING: WHO ARE THE VICTIMS OF UVALDE ELEMENTARY SCHOOL?

Jackie Cazares Uvalde mass shooting victim

Jackie Cazares, one of the victims of the mass shooting Robb Elementary School in Uvalde, is seen in this undated photo obtained from social media. (Jackie Cazares' Family/via Reuters)

Officials say the shooter "encountered" a school district security officer outside the school, though there were conflicting reports from authorities on whether the men exchanged gunfire.

After running inside, the gunman fired on two arriving Uvalde police officers who were outside the building, said Texas Department of Public Safety spokesperson Travis Considine. The police officers were injured.

The shooter then went inside a classroom and began killing.

Texas school shooting police officer lights candle

A man lights a candle outside Robb Elementary School in Uvalde, Texas, Wednesday, May 25, 2022. (AP Photo/Jae C. Hong)

UVALDE MOTHER LIVING NEAR SCHOOL SHARES TEACHER'S HEROIC ACTIONS DURING ROBB ELEMENTARY SHOOTING

The gunman wasn’t killed for the better part of an hour until a Border Patrol team tactical unit arrived and shot him. Border Patrol agents were in the area because Uvalde is near the Mexican border.

A person who spoke on condition of anonymity said Border Patrol had trouble opening the locked door and a staff member had to get a key. 

Texas school shooting mourners

A woman cries as she leaves the Uvalde Civic Center, Tuesday May 24, 2022, in Uvalde, Texas. (William Luther/The San Antonio Express-News via AP)

McCraw told reporters that 40 minutes to an hour elapsed from when Ramos opened fire on the school security officer to when the tactical team shot him, though a department spokesman said later that they could not give a solid estimate of how long the gunman was in the school or when he was killed.

CLICK HERE TO GET THE FOX NEWS APP

"The bottom line is law enforcement was there," McCraw said. "They did engage immediately. They did contain (Ramos) in the classroom."

The Associated Press contributed to this report.