The tragedy in Uvalde, about 90 minutes west of San Antonio, comes just days after another deadly mass shooting in Buffalo, New York and amid a rapid rise in active shooter incidents in the country.
JUST IN: Beto O'Rourke interrupts Texas Gov. Abbott at Uvalde news conference, calls shooting 'totally predictable'
"When parents drop their kids off at school, they have every expectation to know that they're going to be able to pick their child up when that school day ends. And there are families who are in mourning right now," said Texas Gov. Greg Abbott.
"The state of Texas is in mourning with them for the reality that these parents are not going to be able to pick up their children."
MORE: What we know about Texas elementary school shooting victims so far
The students killed were mainly third- and fourth-graders, according to law enforcement sources. Among them was Amerie jo Garza, who just celebrated her 10th birthday two weeks ago, according to her father, Angel.
"My little love is now flying high with the angels above," he wrote in a statement to ABC News. "Please don't take a second for granted. Hug your family. Tell them you love them. I love you Amerie jo."
The 18-year-old suspect, Salvador Ramos, a student at Uvalde High School, is also dead, Abbott said, adding that Ramos "shot and killed horrifically and incomprehensibly."
WATCH: Details emerge about suspected gunman after Texas shooting
Sources said that the gunman first shot his grandmother at a separate scene. Authorities initially said the grandmother was killed but later said she was in critical condition.
Then he crashed his car outside of the school and emerged with an AR-15-style rifle, according to multiple law enforcement sources.
Sources say he legally purchased two AR-style rifles on May 22, just two days before the shooting and six days after his 18th birthday. Authorities have recovered the guns, body armor the suspect was wearing and numerous magazines and are analyzing the evidence, sources said.
The suspect was immediately engaged outside the building as he approached the school by a Uvalde Independent School District police officer, who was shot by the suspect, the sources said.
MORE: Dad searches for 10-year-old daughter at funeral home after Texas school shooting
After that, the suspect entered the school and allegedly opened fire, killing 19 students, who were mainly third- and fourth-graders, as well as one teacher, the sources said. Law enforcement believe he was in the building for roughly 40 minutes to an hour after that first encounter with a resource officer outside the school.
He traded gunfire with Uvalde ISD officer and Border Patrol Tactical Unit agents, a number of whom have children who attend the school, according to the sources. The Border Patrol agents responded to a law enforcement request for assistance.
Investigators are going through ballistics to determine who fired the shot that killed the suspect.
VIDEO: Watch Warriors' Steve Kerr's raw, emotional plea after Texas shooting
A fourth-grade student who was inside the school at the time described the horror of the shooting in an interview with ABC News. He said the students heard banging on a window and then the teacher saw the shooter.
"She said, 'Oh, my God, there's a there's a gun.' And then she she said it was like a big one like that a big gun -- she said, hurry up and get on the floor," the student recounted. "We just hear all kinds of gunshots going off, like nonstop, like constantly gunshots. And then we're over here all scared. What -- on the ground fearing for our lives."
Multiple social media users interviewed by ABC News said the accused shooter reportedly sent videos and photos of guns to other users on various social media platforms. Law enforcement has been made aware of and is reviewing screenshots of alleged messages from the suspect to one Instagram user, who posted them publicly on her account after the shooting.
Abbott also said the shooter made three "social media posts" about 30 minutes before the Robb Elementary School attack, but a spokesperson from Meta said "the messages Gov. Abbott described were private one-to-one text messages that were discovered after the terrible tragedy occurred."
According to the governor, Ramos wrote that he was going to shoot his grandmother, then that he had shot the woman, and finally that he was going to shoot an elementary school.
SEE ALSO: US sees sharp rise in deadly mass shootings
Two responding police officers were among those injured, Abbott said. They are expected to survive, he said. One of the Border Patrol agents sustained injuries while trying to protect students and is at the hospital recovering, Del Rio Sector Chief Jason D. Owens told ABC News.
Three adults and three children injured in the Texas elementary school shooting remain hospitalized on Wednesday.
Uvalde Memorial Hospital initially received 13 children as patients. Two of them died and three were transferred to San Antonio for treatment, the hospital said. The conditions of the others was not immediately clear. A 45-year-old was also hospitalized after getting grazed by a bullet, the hospital said.
University Health in San Antonio said it had four patients from the shooting incident -- three students and an adult woman. A 66-year-old woman and 10-year-old girl were in critical condition.
WATCH: President Biden says 'we have to act' after Texas school shooting
Two adult victims of the shooting, both in critical condition, are also being treated at Brooke Army Medical Center in San Antonio, according to an Army official.
A number of the shooting victims are children of Customs and Border Patrol agents, law enforcement sources told ABC News.
Earlier, the Uvalde Consolidated Independent School District had said a shooter was located at Robb Elementary School and asked people to stay away from the area.
TAKE ACTION: Resources for survivors and victims of gun violence
"There is an active shooter at Robb Elementary," the school district said on Twitter. "Law enforcement is on site. Your cooperation is needed at this time by not visiting the campus. As soon as more information is gathered it will be shared."
There is an active shooter at Robb Elementary. Law enforcement is on site. Your cooperation is needed at this time by not visiting the campus. As soon as more information is gathered it will be shared.— Uvalde CISD (@Uvalde_CISD) May 24, 2022
The rest of the district is under a Secure Status.
The shooting occurred shortly after 11:30 a.m. local time, police said.
The school, which has students in the second, third and fourth grades, informed parents shortly after 2 p.m. that students had been transported to the Sgt. Willie Deleon Civic Center, the reunification site, and could be picked up.
Parent Ryan Ramirez told San Antonio ABC affiliate KSAT he had gone to the civic center and the elementary school trying to find his fourth grade daughter in the wake of the shooting.
"[I'm] just confused and worried. I'm trying to find out where my baby's at," he told the station.
The Houston Field Division of the Bureau of Alcohol, Tobacco, Firearms and Explosives also said it is assisting in the investigation.
Department of Homeland Security Secretary Alejandro Mayorkas has been briefed on the situation and the agency "is actively coordinating with federal, state, and local partners," a spokesperson said. Customs and Border Protection officials in the area also responded to the scene.
The National Counterterrorism Operations Center believes there is "no known terrorism nexus" at this time, according to a law enforcement bulletin obtained by ABC News.
“Why are you here?!"— ABC News (@ABC) May 24, 2022
A furious Sen. Chris Murphy demands answers from senators following Texas school shooting.
“Why do you spend all this time running for the United States Senate...if your answer, is as the slaughter increases, as our kids run for their lives—we do nothing?” pic.twitter.com/9fkJ13vWGd
ABC News' Pierre Thomas, Luke Barr, Jack Date, Nicholas Kerr and Mireya Villarreal contributed to this report.