The gunman, 18, died at the scene.
Officials said the gunman, an 18-year-old resident of the county where the shooting took place, shot his grandmother in the face and left her wounded in her home before driving a pickup truck at a high speed and crashing it through a barrier outside the school.
The grandmother, who contacted the police, was in serious condition on Wednesday.
Around 11:30 a.m., the Uvalde police received a 911 call that a truck had crashed at the school and a man had emerged from it with a long rifle and a backpack. The gunman exchanged shots with at least one armed officer from the Uvalde school district, but managed to get past the officer.
The gunman eventually barricaded himself inside a classroom in the school, where he opened fire with what a state police official described as an AR-15-style rifle. He was there for about an hour before a tactical unit from the Border Patrol arrived and shot him several times, killing him, the official said.
The only sign of the gunman’s plans came about 30 minutes before he arrived at the school, when he wrote on Facebook that he was going to shoot his grandmother, Gov. Greg Abbott said at a news conference. In a second post on Facebook, the gunman wrote that he had shot his grandmother, the governor said. In a third post, the gunman said he was going to shoot an elementary school.
It continued a devastating pattern in the United States.
The shooting is one of the deadliest school attacks on record. It is also one of more than 200 mass shootings to have been recorded in the United States so far this year. Just 10 days earlier, a gunman fatally shot 10 people at a Buffalo grocery store.
Gun control is in the spotlight.
President Biden’s nominee to lead the Bureau of Alcohol, Tobacco, Firearms and Explosives appeared before the Senate Judiciary Committee on Wednesday. Steven M. Dettelbach’s confirmation would be a make-or-break moment for the president’s stalled agenda on gun control. Read more about Mr. Dettelbach here.
In an address to the nation on Tuesday, Mr. Biden did not call for specific gun control measures. “When in God’s name will we do what we all know in our gut needs to be done?” he asked.
The National Rifle Association is set to hold its annual meeting in Houston starting on Friday. Scheduled speakers include Mr. Abbott, former President Donald J. Trump and Senator Ted Cruz, Republican of Texas.