Watch: Texas school shooting death toll rises to 19 children
“I got lil secret I wanna tell you,” the Texas school shooter messaged a woman he knew on Instagram hours before the attack.
Salvador Ramos "tagged" the girl in a photo of automatic rifles, hoping she would be impressed.
“Be grateful I tagged you,” he wrote. “No it's just scary,” she replied.
Not long after the 18-year-old used one of the guns - an AR-15-style rifle - to shoot and kill 19 students and two adults, including a teacher, at Robb Elementary School in the small town of Uvalde, halfway between San Antonio and the Mexican border.
It was the deadliest such incident since 14 high school students and three adult staff were killed in Parkland, Florida in 2018 - and the worst at a primary school since the 2012 Sandy Hook shooting in Connecticut, in which 20 children and six staff were killed.
Earlier on Tuesday morning, Ramos shot and injured his grandmother before getting into his car and driving towards Robb Elementary.
Sergeant Erick Estrada told CNN he crashed into a ditch next to a funeral home opposite the school and entered into a shootout with Border Patrol agents. It is not yet clear if the school was his intended target, but he had clearly come prepared.
Ramos got out of the vehicle, carrying his rifle and sporting a menacing all-black outfit and body armour.
The teenager entered the school through a south entrance at 11.30am local time just after the school’s mid-morning lesson break.
Seconds later he would open fire on classrooms filled with students aged between 7-10 years old, killing 19 of them and two adults, one of them being fourth-grade teacher Eva Mireles.
The victims were rushed to nearby hospital but were pronounced dead on arrival.
An elite BORTAC Border Patrol agent who was nearby when the shooting began rushed into the school without waiting for backup and shot and killed Ramos, who was behind a barricade, according to the Associated Press. He was injured but expected to recover.
University Health in San Antonio continued to treat two patients - a 66-year-old woman and a 10-year-old girl - who are both in critical condition.
Relatives of the injured say Ramos, who was born in South Dakota before moving to 16,000-population Uvalde, shot several of the children in the arm and in the face.
An hour after the shooting began, small groups of children began emerging from the building, some holding hands as they fled under police escort to a safety point.
Robb elementary’s students - 90 per cent of whom are Hispanic - had been holding a day of celebrations, receiving certificates for the end of the school year. They had just two days of school left before they broke for the summer holiday.
Like is so far known about Ramos but his social media account gave some clues.
At 5:45am the morning of the shooting, Ramos, using the handle @salv8dor_ messaged a woman “I’m about to”. The girl asked “about to what” to which he answered, “I’ll tell you before 11”.
He said he would text her in an hour and urged her to respond. He never told her his secret.
His profile had photos of guns, which he bought legally on his 18th birthday, according to state senator Roland Gutierrez. "It was the first thing he did when he turned 18,” Mr Gutierrez said.
His Instagram account’s single post features three photos - a mirror selfie of Ramos in a sweatshirt, a grainy black-and-white close-up of his face, and a first-person shot of a person holding a firearm magazine in their lap.
The tragedy in Uvalde was the deadliest school shooting in Texas history, and it added to a grim tally of mass shootings in the state that have been among the deadliest in the US over the past five years.