The day after his 18th birthday, Salvador Ramos, a troubled teenager from small-town Texas, bought his first assault rifle. A week later, he walked into a local elementary school, where he shot and killed 19 young children and two of their teachers.
Authorities were still trying to piece together what drove Ramos to commit America's worst school massacre in a decade, but here is what is known so far about the shooting:
Described as a long-bullied youth with a history of self-harm, Ramos turned 18 on May 16 and bought an assault rifle the very next day.
He purchased 375 rounds of ammunition on May 18, and then a second rifle two days after that.
Ramos -- a dropout with no criminal history -- messaged on Facebook Tuesday morning that he planned to attack his grandmother, whom he lived with, Texas Governor Greg Abbott said.
Ramos shot his 66-year-old relative in the face, but she was able to call the police and was airlifted in critical condition to a hospital in nearby San Antonio.
The shooter then messaged again on social media to say he had followed through on his plan to attack his grandmother, and that an elementary school was his next target.
He drove a little over two miles (3.2 kilometers), crashing it near Robb Elementary School.
He took an assault rifle with him and headed for the school, where more than 500 students in grades two to four -- aged around seven to 10 years old -- had just three days of class left before summer vacation.
Ramos, clad in black and wearing a tactical vest, was confronted by a school resource officer, but was able to enter the school through a back door.
He then made his way to two adjoining classrooms.
"That's where the carnage began," said Steve McCraw, director of the Texas Department of Public Safety.
The identities of the victims have been gradually revealed as shattered families share their pain online: Xavier Lopez, a 10-year-old boy who loved to dance; Ellie Garcia, "the happiest ever" in her father's words and Amerie Jo Garza, a girl with a brilliant smile who had just celebrated her 10th birthday.
As a crowd grew nearby, police arrived on the scene in response to a report of a crashed vehicle.
Hearing shots coming from the school, they ran inside and themselves came under gunfire.
Some police started to break windows and evacuate children and teachers from the premises.
Law enforcement on site helped pin the shooter in place until a tactical team that included US Border Patrol agents was assembled.
"Upon entering the building, agents and other law enforcement officers faced gunfire from the subject, who was barricaded inside," said Department of Homeland Security spokesperson Marsha Espinosa.
Law enforcement officers "put themselves between the shooter and children on the scene to draw the shooter's attention away from potential victims," said Espinosa.
It was more than 30 minutes after Ramos entered the school that he was finally shot and killed by one of the Border Patrol agents.