Onlookers urged police officers to charge into a Texas primary school after an 18-year-old gunman entered the building. 

The shooting killed 19 children and two teachers who were barricaded into a classroom alongside the assailant at Robb Elementary in Uvalde.

“Go in there! Go in there!” nearby women shouted at the officers soon after the attack began, said 24-year-old Juan Carranza, who saw the scene from outside his house. 

The witness claimed that officers did not immediately go in. 

Minutes earlier, Mr Carranza had watched as Salvador 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.

Officials say he “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, he 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.

After entering the school, Ramos charged into one classroom and began to kill.

He “barricaded himself by locking the door and just started shooting children and teachers that were inside that classroom”, 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.

The Herald:

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

Before attacking the school, Ramos shot and wounded his grandmother at the home they shared, authorities said.

Investigators also shed no light on Ramos’ motive for the attack, which also left at least 17 people wounded.

Texas Governor Greg Abbott said Ramos had no known criminal or mental health history.

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

About a half-hour before the mass shooting, Ramos sent the first of three online messages warning about his plans, Mr 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.

Ramos sent the private, one-to-one text messages via Facebook, said company spokesman Andy Stone.

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

Amid calls 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 Mr Abbott for governor, interrupted Wednesday’s news conference, calling the tragedy “predictable”.

Pointing his finger at Mr Abbott, he said: “This is on you until you choose to do something different. This will continue to happen.”

Mr O’Rourke was escorted out as some in the room yelled at him.