UVALDE, Texas — A gunman killed at least 19 children and two adults on Tuesday in a rural Texas elementary school, a state police official said, in the deadliest American school shooting since the massacre at Sandy Hook Elementary a decade ago.

The slayings took place just before noon at Robb Elementary School, where second through fourth graders in Uvalde, a small city west of San Antonio, were preparing to start summer break this week. At least one teacher was among the adults killed, and several other children were wounded.

The gunman, whom the authorities identified as an 18-year-old man who had attended a nearby high school, was armed with several weapons, officials said. He died at the scene, they said.

“He shot and killed horrifically, incomprehensibly,” Gov. Greg Abbott said in a news conference.

As terrified parents in Uvalde late Tuesday waited for word of their children’s safety and law enforcement officials raced to piece together how the massacre had transpired, the mass shooting was deepening national political debate over gun laws and the prevalence of weapons. Ten days earlier, a gunman fatally shot 10 people inside a Buffalo, New York, grocery store.

“This is just evil,” Rey Chapa, an Uvalde resident, said of Tuesday’s killings, using an expletive. Chapa said his nephew was in the school when the shooting took place but was safe. He was waiting to hear back from relatives and friends on the conditions of other children, scrolling through Facebook for updates. “I’m afraid I’m going to know a lot of these kids that were killed.”

Across the street from the school on Tuesday evening, state troopers were scattered across the school lawn and an ambulance idled with its lights flashing. Adolfo Hernandez, a longtime Uvalde resident, said his nephew had been in a classroom near where the shooting took place.

“He actually witnessed his little friend get shot in the face,” Hernandez said. The friend, he said, “got shot in the nose and he just went down, and my nephew was devastated.”

The shooting took place on election day in Texas, as voters across the state headed to the polls for primary runoffs that would set the stage for the November election at a time when the state and the nation have been riven by political disagreements over race, immigration and abortion.

As the deadly toll became known, the events at Robb Elementary School immediately brought forth wrenching memories of the devastating 2012 shooting at Sandy Hook in Newtown, Connecticut, that left six staff members and 20 children dead, some as young as 6 years old.

Lydia Martinez Delgado said that her niece Eva Mireles, a teacher of fourth graders at the school, was among those who had died in the rampage. Mireles had been a teacher for 17 years, her aunt said, and was “very loved,” an avid hiker and took pride in teaching mostly students of Latino heritage. “She was the fun of the party,” Delgado said.

For many, the weight of the tragedy appeared to be compounded by its arrival so soon after a deadly mass killing of Black shoppers in a grocery store in Buffalo, in what was one of the deadliest racist massacres in recent American history. It had been the deadliest shooting in the United States this year until Tuesday’s massacre in Uvalde.

Abbott said that the shooter was a resident of the same county where the shooting took place, that he attended high school there and that he had acted alone. He entered the elementary school with a handgun and possibly a rifle, the governor said.

It was not immediately clear whether the shooting took place in one classroom or several and officials did not release the names or ages of the students killed or of the teacher. At least three children — a 9-year-old and two 10-year-olds, one in critical condition — were taken to University Health, a hospital in San Antonio, for treatment.

Officials were looking into whether the gunman, whom they identified as Salvador Ramos, had been targeting the school or whether he ended up there by chance, according to a law enforcement official, who requested anonymity to describe the investigation that he cautioned was still unfolding. The gunman appeared to have crashed a pickup truck through a barrier at the school before heading inside, the official said. At least two law enforcement officials who had tried to engage the gunman were injured in the shooting, neither seriously, the official said.

Shortly before the massacre, a 66-year-old woman was airlifted to a San Antonio hospital with gunshot wounds. The official said the woman appeared to have been the gunman’s grandmother and had been shot before the shooting at the school; both shootings, and the connection between them, remained under investigation.

The shooting took place just after 11:30 a.m. For much of the afternoon, as word spread, anguished parents were instructed by the district to stay away from the school. “Please do not pick up students at this time,” the school district instructed parents, directing them to a local civic center. “Students need to be accounted for before they are released to your care.”

Parents and relatives scrambled for any information as news of a shooter at the school turned into the realization that so many children had been killed.

Ryan Ramirez told KSAT in San Antonio that he could not find his daughter, a fourth grader at Robb Elementary, when he showed up at the school or at a reunification point at a civic center. “Nobody’s telling me anything,” he said, adding, “I’m trying to find out where my baby’s at.”

Even before much was known about the gunman, his motives or details about the weapons he used, the massacre thrust the debate over gun control and Second Amendment rights back into the forefront of national attention.

Sen. Chris Murphy, D-Conn., an advocate for gun control legislation, said, “I think everybody here is going to be shaken to the core by this.” He added: “I have no idea how a community deals with this. There’s no way to do this well. Your community is never ever the same after this.”

The National Rifle Association is set to hold its annual meeting in Houston starting on Friday. Abbott is among the list of prominent Republicans slated to appear, along with former President Donald Trump and Sen. Ted Cruz.

“Today is a dark day,” Cruz said in a statement. In messages posted to Twitter he said the nation had “seen too many of these shootings,” but he did not immediately call for any specific policy proposals to help prevent mass killings.

Sen. Joe Manchin, D-W.Va., whose effort at legislation on background checks for gun purchases was blocked in 2013, said, “It makes no sense at all why we can’t do common-sense things and try to prevent some of this from happening.”

Robb Elementary, a brick school building near the edge of the city center, serves more than 500 students, mostly between ages 7 and 10. Roughly 90% of the students are Hispanic, according to district records, and almost all of the rest are white. A sign hanging from the school reads “Welcome!” and “¡Bienvenidos!” next to the school’s logo, a heart.

In the neighborhood around the school, more than 40% of residents have lived in the same house for at least 30 years, census data shows. And more than a quarter of the 15,000 residents in Uvalde are children, far above the national average. More than a third live at or barely above the federal poverty line.

U.S. Rep. Joaquin Castro, D-Texas, described Uvalde on Twitter as a “wonderful, tight-knit community.”

This article originally appeared in The New York Times.