UVALDE, Texas -- Salvador Ramos, the suspect in the Texas elementary school shooting, after turning 18 on May 16, legally purchased two rifles and carried out the second-worst school shooting in U.S. history within the span of eight days, according to multiple law enforcement officials.
The suspect purchased two AR-15-style rifles on May 22, two days before the massacre and six days after his birthday, multiple law enforcement officials told ABC News. They were legal purchases.
At least 19 children and two teachers were killed at Robb Elementary School in Uvalde, about 90 minutes west of San Antonio, authorities said. Ramos, a student at Uvalde High School, is also dead.
Once the shooter made entry into a classroom he barricaded himself and allegedly opened fire, killing 18 students, who were mainly third- and fourth-graders, as well as one teacher, sources said.
MORE: What we know about Texas elementary school shooting victims so far
Officers from the Uvalde Police Department and agents from Customs and Border Protection entered the classroom and immediately took fire from the gunman before they shot and killed him.
Investigators are going through the ballistics to determine who fired the fatal shot.
They're also working to uncover how and when he assembled his arsenal, which included the rifle, body armor and numerous magazines recovered at the scene, sources said.
MORE: Texas elementary school shooting live updates
Gunman's grandfather says he was unaware the suspect purchased weapons
Rolando Reyes, 72, the gunman's grandfather, told ABC News he had no idea his grandson had purchased two AR-15-style rifles or that they were in his house.
Since Reyes is a felon, it is illegal for him to live in a house with firearms. Reyes said he would have turned his grandson in.
Reyes said there were no signs the morning of the shooting that anything unusual was going to happen. The suspect had a minor argument with his grandmother over the payment of a phone bill, but nothing significant.
The suspect lived in a front room and slept on a mattress on the floor, according to Reyes. The suspect had been staying with his grandparents after having a falling out with his mother.
SEE ALSO: US sees sharp rise in deadly mass shootings
Reyes said he took the suspect to work sometimes and that he was very quiet, but he did not seem violent. Reyes also said he tried to encourage his grandson to go to school but the suspect would typically just shrug in response.
Reyes said the suspect did not know how to drive and did not have a driver's license. Reyes also wondered how his grandson would have even gone to purchase the weapons or if he trained on the weapons, saying someone must have taken him there.
The suspect's grandmother, who he shot in the forehead, is undergoing surgery on Wednesday. Reyes said he believes she will survive.
Classmates say Ramos was known for fighting
Uvalde High School students told ABC News that Ramos was known for fighting and threatening classmates.
Nathan Romo, who had witnessed part of the shooting, had once been friends with him.
"I used to be his friend, but then I told him that I was going to stop being his friend because he was being weird with not only me but with a lot of other people," Romo said.
WATCH: President Biden says 'we have to act' after Texas school shooting
Several classmates said the suspect rarely went to school and when he did, he sometimes frightened students, like Yarelli Vasquez.
"He had scars on his face. I remember someone asked him, 'What happened? Are you OK?' because he showed up to school with them," Vasquez told ABC News. "He just straight out told them with a smile, 'I did them myself cause I like how it looks.'
Vasquez had also worked with him at a local restaurant.
Social media accounts under investigation
The shooter also allegedly left a trail of disturbing social media posts that hinted at an attack.
Investigators are now poring over the gunman's accounts where he reportedly sent videos and photos of guns and images of animal abuse to other users.
TAKE ACTION: Resources for survivors and victims of gun violence
As recently as Tuesday morning, an Instagram account believed to be connected to the shooter sent a photo of a gun laying on a bed to another user.
Law enforcement also reviewed screenshots of messages the suspect allegedly sent a different Instagram user, tagging them in an image of firearms.
The day before the shooting, the gunman also reportedly posted "wait till tomorrow" on the platform Yubo.
ABC Owned TV Stations contributed to this report.