UVALDE, Texas (AP) - Onlookers urged police officers to charge into the Texas elementary school where a gunman's rampage killed 19 children and two teachers, witnesses said Wednesday, as investigators worked to track the massacre that lasted upwards of 40 minutes and ended when the 18-year-old shooter was killed by a Border Patrol team.

“Go in there! Go in there!” nearby women shouted at the officers soon after the attack began, said Juan Carranza, 24, who saw the scene from outside his house, across the street from Robb Elementary School in the town of Uvalde. Carranza said the officers did not go in.

Javier Cazares, whose fourth grade daughter, Jacklyn Cazares, was killed in the attack, said he raced to the school when he heard about the shooting, arriving while police were still massed outside the building.

Upset that police were not moving in, he raised the idea of charging into the school with several other bystanders.

“Let's just rush in because the cops aren't doing anything like they are supposed to,” he said. “More could have been done.”

“They were unprepared,” he added.

Minutes earlier, Carranza had watched as Ramos crashed his truck into a ditch outside the school, grabbed his AR-15-style semi-automatic rifle and shot at two people outside a nearby funeral home who ran away uninjured.

He then exchanged fire with a school district security officer, ran inside and fired on two arriving Uvalde police officers who were outside the building, said Texas Department of Public Safety spokesperson Travis Considine. All the law enforcement officers were injured, he said.

Hours later, Considine said authorities did not know for sure whether the school officer exchanged gunfire with Ramos. Law enforcement officials have also issued sometimes-contradictory statements about the length of Ramos' rampage.

After entering the school, Ramos charged into one classroom and began to kill, a law enforcement official said.

He “barricaded himself by locking the door and just started shooting children and teachers that were inside that classroom,” Lt. Christopher Olivarez of the Department of Public Safety told CNN. “It just shows you the complete evil of the shooter.”

All those killed were in the same classroom, he said.

Department of Public Safety Director Steve McCraw said “40 minutes or so” elapsed from when Ramos opened fire on the school security officer and when the SWAT-like Border Patrol team shot him.

A law enforcement official familiar with the investigation said the Border Patrol agents had trouble breaching the classroom door and had to get a staff member to open the room with a key. The official spoke on the condition of anonymity because he was not authorized to speak publicly about the ongoing investigation.

Carranza felt the officers should have entered the school sooner.

“There were more of them, there was just one of him,” he said.

Uvalde is a largely Latino town of some 16,000 people about 75 miles (120 kilometers) from the Mexican border. Robb Elementary, which has nearly 600 students in second, third and fourth grades, is a single-story brick structure in a mostly residential neighborhood of modest homes.

Before attacking the school, Ramos shot and wounded his grandmother at her home. Neighbors called police when she staggered outside and they saw she had been shot in the face, Considine said.

Ramos had legally bought the rifle and a second one like it last week, just after his birthday, authorities said.

Investigators shed no light on the motive for the attack, which also left at least 17 people wounded. Abbott said Ramos, a resident of the small town about 85 miles (135 kilometers) west of San Antonio, had no known criminal or mental health history.

“Evil swept across Uvalde yesterday,” Abbott said.

About a half-hour before the mass shooting, Ramos sent the first of three online messages, Abbott said. Ramos wrote that he was going to shoot his grandmother, then that he had shot the woman. In the last note, sent about 15 minutes before he reached Robb Elementary, he said he was going to shoot up an elementary school, according to Abbott. Investigators said Ramos did not specify which school.

Ramos sent the private, one-to-one text messages via Facebook, and they were “discovered after the terrible tragedy,” company spokesman Andy Stone said. He said Facebook is cooperating with investigators.

Grief engulfed Uvalde as details emerged of the latest mass killing to rock the U.S.

The dead included Eliahna Garcia, an outgoing 10-year-old who loved to sing, dance and play basketball; a fellow fourth-grader, Xavier James Lopez, who had been eagerly awaiting a summer of swimming; and a teacher, Eva Mireles, with 17 years' experience whose husband is an officer with the school district's police department.

“You can just tell by their angelic smiles that they were loved,” Uvalde Schools Superintendent Hal Harrell said, fighting back tears as he recalled the children and teachers killed.

Amid calls around the U.S. for tighter restrictions on firearms, the Republican governor repeatedly talked about mental health struggles among Texas young people and argued that tougher gun laws in Chicago, New York and California are ineffective.

Democrat Beto O'Rourke, who is running against Abbott for governor, interrupted Wednesday's news conference, calling the tragedy “predictable.” Pointing his finger at Abbott, he said: “This is on you until you choose to do something different. This will continue to happen.” O'Rourke was escorted out as some in the room yelled at him. Uvalde Mayor Don McLaughlin yelled that O'Rourke was a “sick son of a bitch.”

Texas has some of the most gun-friendly laws in the nation and has been the site of some of the deadliest shootings in the U.S. over the past five years.

“I just don't know how people can sell that type of a gun to a kid 18 years old,” Siria Arizmendi, the aunt of victim Eliahna Garcia, said angrily through tears. “What is he going to use it for but for that purpose?”

The attack was the deadliest school shooting in the U.S. since a gunman killed 20 children and six adults at Sandy Hook Elementary in Newtown, Connecticut, in December 2012.

The Uvalde tragedy was the latest in a seemingly unending wave of mass shootings across the U.S. in recent years. Just 10 days earlier, 10 Black people were shot to death in a racist attack at a Buffalo, New York, supermarket.

President Joe Biden said Wednesday that “the Second Amendment is not absolute” as he called for new limitations on guns in the wake of the massacre.

But the prospects for reform of the nation's gun regulations appeared dim. Repeated attempts over the years to expand background checks and enact other curbs have run into Republican opposition in Congress.

The shooting came days before the National Rifle Association annual convention was set to begin in Houston, with the Texas governor and both of the state's Republican U.S. senators scheduled to speak.

Investigators do not yet know why Ramos targeted the school, said McCraw of the Department of Public Safety.

“We don't see a motive or catalyst right now,” he said.

Officers found one of the rifles in Ramos' truck, the other in the school, according to the briefing given to lawmakers. Ramos was wearing a tactical vest, but it had no hardened body-armor plates inside, lawmakers were told. He also dropped a backpack containing several magazines full of ammunition near the school entrance.

Dillon Silva, whose nephew was in a classroom, said students were watching the Disney movie “Moana” when they heard several loud pops and a bullet shattered a window. Moments later, their teacher saw the attacker stride past the door.

“Oh, my God, he has a gun!” the teacher shouted twice, according to Silva. “The teacher didn't even have time to lock the door,” he said.

Three children and an adult remained at a San Antonio hospital, where two of them - a 66-year-old woman and 10-year-old girl - were listed in serious condition.

The close-knit community, built around a shaded central square, includes many families who have lived there for generations. It sits amid fields of cabbage, onions, carrots and other vegetables.

Residents are knitted together by family and friendship, said Joe Ruiz, a pastor born and raised in Uvalde with children and grandchildren there.

“Everybody knows everybody or is connected to everybody,” said Ruiz.

His cousin's wife, he said, was one of the teachers killed in the attack.

Eugene Garcia and Dario Lopez-Mills in Uvalde; Jake Bleiberg in Dallas; Ben Fox, Michael Balsamo, Amanda Seitz and Eric Tucker in Washington; Paul J. Weber in Austin; Juan Lozano in Houston; Gene Johnson in Seattle and Rhonda Shafner in New York contributed to this report.

Correction - May 27, 2022: This article has been updated from a previous version that incorrectly stated one of the victim's middle name.