The teenage gunman, identified by the Texas police as the suspect in the shooting at the Robb Elementary School in Uvalde, went from classroom to classroom, killing at least 19 students and two adults, said officials.
Gov. Greg Abbott said one of the two was a teacher.
The suspect has been identified as 18-year-old Salvador Ramos. He acted alone and was killed by law enforcement.
The massacre at Robb Elementary School in the heavily Latino town of Uvalde was the deadliest shooting at a US grade school since a gunman killed 20 children and six adults at Sandy Hook Elementary in Newtown, Connecticut, almost a decade ago.
Investigators believe Ramos posted photos on Instagram of two guns he used in the shooting, and they were examining whether he made statements online alluding to the attack in the hours before the assault, a law enforcement official said.
Law enforcement officers were serving multiple search warrants Tuesday night and gathering telephone and other records, the official said. Investigators were also attempting to contact Ramos’ relatives and were tracing the firearms.
How it unfolded
The attack began at about 11.30 am (10.30 pm IST) when the gunman crashed his car outside the school and ran into the building, according to Travis Considine, a spokesman for the Texas Department of Public Safety. A resident who heard the crash called 911, and two local police officers exchanged gunfire with the shooter.
Both officers were shot, though it was not immediately clear where on the campus that confrontation occurred, or how much time elapsed before more authorities arrived on the scene.
Meanwhile, teams of Border Patrol agents raced to the school, including 10 to 15 members of a SWAT-like tactical and counter-terrorism unit, said Jason Owens, a top regional official with the Border Patrol.
One Border Patrol agent who was working nearby when the shooting began rushed into the school without waiting for backup and shot and killed the gunman, who was behind a barricade, according to a law enforcement official speaking on condition of anonymity because he was not authorised to talk about it.
The agent was wounded but able to walk out of the school, the law enforcement source said. Owens confirmed that an agent suffered minor injuries, but would not provide details of that confrontation.
The gunman was wearing body armour and was reportedly armed with a handgun, an AR-15 semiautomatic rifle, and high-capacity ammunition magazines.
Texas senator Roland Gutierrez said Ramos shot his grandmother before heading to the school with two military-style rifles he had purchased on his birthday. “That was the first thing he did on his 18th birthday,” said Gutierrez .
Officials did not immediately reveal a motive, but the Texas governor identified the assailant as Salvador Ramos and said he was a resident of the community about 135 kilometres west of San Antonio.
Ramos had hinted on social media that an attack could be coming, Gutierrez said, noting that “he suggested the kids should watch out.”
A Border Patrol agent who was working nearby when the shooting began rushed into the school without waiting for backup and shot and killed the gunman, who was behind a barricade, according to a law enforcement official speaking on condition of anonymity to Reuters because he was not authorised to talk about it.
The agent was wounded but able to walk out of the school, the law enforcement source said.
(With inputs from Reuters and Associated Press reports)