UVALDE, Texas (AP) — An official says an 18-year-old gunman who killed 19 children and two teachers at a Texas elementary school barricaded himself inside a classroom, “shooting anyone that was in his way.”

Lt. Christopher Olivarez of the Texas Department of Public Safety said police and others responding to Tuesday’s attack broke windows at the school in an effort to allow students and teachers inside to escape.

Olivarez also said all victims were in the same fourth-grade classroom at Robb Elementary School. Eventually law enforcement officers broke into the classroom and killed him.

The death toll also included three adults, according to state Sen. Roland Gutierrez, who said he had been briefed by state police. But it was not immediately clear whether that number included the attacker.

The massacre at Robb Elementary School in the heavily Latino town of Uvalde was the deadliest shooting at a U.S. grade school since a gunmen killed 20 children and six adults at Sandy Hook Elementary in Newtown, Connecticut, almost a decade ago.

The attack came just 10 days after a deadly, racist rampage at a Buffalo, New York, supermarket that added to a years long series of mass killings at churches, schools and stores. And the prospects for any reform of the nation’s gun regulations seemed at least as dim as in the aftermath of the Sandy Hook deaths.

Emergency personnel gather near Robb Elementary School following a shooting, Tuesday, May 24, 2022, in Uvalde, Texas. (AP Photo/Dario Lopez-Mills)

“My heart is broken today,” said Hal Harrell, the school district superintendent, announcing that all school activities were cancelled until further notice. “We’re a small community and we’re going to need you prayers to get through this.”

The gunman, who was wearing body armor and had hinted on social media of an upcoming attack, crashed his car outside the school and went inside armed, Sgt. Erick Estrada of the Texas Department of Public Safety told CNN.

He killed his grandmother before heading to the school with two military-style rifles he had purchased on his birthday, Gutierrez said.

“That was the first thing he did on his 18th birthday,” he said.

Law enforcement personnel walk outside Uvalde High School after shooting a was reported earlier in the day at Robb Elementary School, Tuesday, May 24, 2022, in Uvalde, Texas. (William Luther/The San Antonio Express-News via AP)

Officials did not immediately reveal a motive, but the governor identified the assailant as Salvador Ramos and said he was a resident of the community about 85 miles (135 kilometers) west of San Antonio.

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 because he was not authorized to talk about it.

The agent was wounded but able to walk out of the school, the law enforcement source said.

The school district’s police chief, Pete Arredondo, said that the attacker acted alone.

It was not immediately clear how many people were wounded, but Arredondo said there were “several injuries.” Earlier, Uvalde Memorial Hospital said 13 children were taken there. Another hospital reported a 66-year-old woman was in critical condition.

A woman cries as she leaves the Uvalde Civic Center, Tuesday May 24, 2022, in Uvalde, Texas An 18-year-old gunman opened fire Tuesday at a Texas elementary school, killing multiple children and a teacher and wounding others, Gov. Greg Abbott said, and the gunman was dead. (William Luther/The San Antonio Express-News via AP)

Robb Elementary School has an enrollment of just under 600 students, and Arredondo said it serves students in the second, third and fourth grade. He did not provide ages of the children who were shot. This was the school’s last week of classes before summer break.

Heavily armed law enforcement officers swarmed to the school, with officers in tactical vests diverting traffic and FBI agents coming and going from the building.

White House press secretary Karine Jean-Pierre said President Joe Biden was briefed on the shooting on Air Force One as he returned from a five-day trip to Asia. Biden was scheduled to deliver remarks Tuesday evening at the White House.

Uvalde, home to about 16,000 people, is about 75 miles (120 kilometers) from the border with Mexico. Robb Elementary is in a mostly residential neighborhood of modest homes.

Police walk near Robb Elementary School following a shooting, Tuesday, May 24, 2022, in Uvalde, Texas. (AP Photo/Dario Lopez-Mills)

The tragedy in Uvalde was the deadliest school shooting in Texas history, and added to a grim tally of mass shootings in the state that has been among the deadliest in the U.S. over the past five years.

In 2018, a gunman fatally shot 10 people at Santa Fe High School in the Houston area. A year before that, a gunman at a Texas church killed more than two dozen people during a Sunday service in the small town of Sutherland Springs. In 2019, another gunman at a Walmart in El Paso killed 23 people in a racist attack.

The shooting came days before the National Rifle Association annual convention was set to begin in Houston. Abbott and both of Texas’ U.S. senators were among elected Republican officials who were the scheduled speakers at a Friday leadership forum sponsored by the NRA’s lobbying arm.

In the years since Sandy Hook, the gun control debate in Congress has waxed and waned. Efforts by lawmakers to change U.S. gun policies in any significant way have consistently faced roadblocks from Republicans and the influence of outside groups such as the NRA.

People leave the Uvalde Civic Center following a shooting earlier in the day at Robb Elementary School, Tuesday, May 24, 2022, in Uvalde, Texas. (William Luther/The San Antonio Express-News via AP)

A year after Sandy Hook, Sens. Joe Manchin a West Virginia Democrat, and Patrick J. Toomey, a Pennsylvania Republican, negotiated a bipartisan proposal to expand the nation’s background check system. But as the measure was close to being brought to the Senate floor for a vote, it became clear it would not get enough votes to clear a 60-vote filibuster hurdle.

Then-President Barack Obama, who had made gun control central to his administration’s goals after the Newtown shooting, called Congress’ failure to act “a pretty shameful day for Washington.”

Last year, the House passed two bills to expand background checks on firearms purchases. One bill would have closed a loophole for private and online sales. The other would have extended the background check review period. Both languished in the 50-50 Senate, where Democrats need at least 10 Republican votes to overcome objections from a filibuster

Associated Press writers Jake Bleiberg in Dallas, Ben Fox in Washington, Paul J. Weber in Austin and Juan Lozano in Houston contributed to this report.