AZTEC, N.M. -- Authorities say a 21-year-old gunmanl Thursday in a planned attack after disguising himself as a student to gain access to the building.San Juan County Sheriff Ken Christesen told reporters Friday that 21-year-old William Atchison of the small town of Aztec had legally purchased a 9mm Glock pistol a month ago.
Officials said Atchison, who had previously attended Aztec High School, went there before buses arrived and was able to "mingle" with students and walk into the building undetected.
Atchison killed the two students apparently at random, one in a restroom and the other just outside, Christesen said. Authorities confirmed Friday they do not believe the gunman targeted
More lives could have been lost had Fernandez not walked into the bathroom, authorities said. That's when the gunman shot Fernandez. Atchison walked out into the hallway and encountered the second victim, Casey J. Marquez, and killed her.
After shooting both dead, he went on a rampage within the school, walking up and down the hallway and shooting through glass and walls as students and teachers barricaded themselves. Then, he fatally shot himself with the same gun.
"This person is not only a coward, he's evil in my mind," Christesen said.
Christesen said writings found on a thumb drive show that the 21-year-old had planned the attack and carried it out with an intent that was "focused" and "deranged." Christesen displayed some of the writings at a press conference Friday.
"If things go according to plan, today would be when I die," the writings said. "I wait until the school buses are detected, then head out on foot disguised as a student. I go somewhere and gear up, then hold a class hostage and go apes----, then blow my brains out."
In the writings, Atchinson spoke of being unhappy with work, school and his life and said, "I just want out of this s---."
Officials said they were still baffled as to a motive but they believe further information on the thumb drive, which has been turned over to the FBI, will help authorities understand what led up to the shooting.
New Mexico State Police chief Pete Kassetas said it was "very obvious" Atchison wanted officials to find the thumb drive because it was on his body.
"There's a lot more information there, we've barely scratched the surface of that, of what was speaking to his mindframe," Kassetas said.
Investigators also found a timeline of what the gunman had planned, with a final time-stamped note that said, "Die."
Speaking Friday, an FBI agent said Atchison had previous been investigated by the FBI after making comments on an online gaming forum about buying "cheap assault rifles" for someone who wanted to commit a mass shooting.
Terry Wade, FBI special agent in charge in Albuquerque, said that the agency checked databases and interviewed him and his family in March 2016.
Wade said the man didn't have a gun at that time and told agents that he had no plans for an attack. He also didn't have ties to any organizations. Family members said Atchison was known for making comments to get people "riled up," Christesen said, and Wade said Atchison admitted he liked to "troll" online.
The FBI closed the investigation when it determined no crime was committed.
Christesen hailed brave acts of school staff and law enforcement who he said helped save lives. He told reporters Friday that a substitute teacher heard the gunshots but didn't have a key to lock the door to the computer lab, so she took students into an office or storage area and barricaded the door with a couch.
He said Atchison came to the room and yelled that he knew they were in there and then fired multiple shots into the room. Christesen and other officials praised the bravery of school staff and law enforcement who arrived at the scene in less than a minute, which he said prevented more bloodshed.
Christesen also hailed a brave custodian who he said pursued the gunman and yelled to alert teachers there was an active shooter and to lock down.
Christesen said it was a "miracle" no other injuries were reported.
The shooting has rocked Aztec, a community of about 6,500 near the Colorado border. Hundreds gathered for prayer services and candlelight vigils to honor the victims and more gatherings are planned over the weekend as residents look for answers.
Marquez was a cheerleader and was planning to participate in the upcoming Orange Bowl. Her classmates said she came across as a student leader.
Bryn Divine, a senior at Aztec High School, remembered the victim being a vibrant and friendly student who often won dance contests at school events.
"She lit up pretty much any room we were all in," Divine said. "She was such a fun person to be around."
Fernandez was known for his speedy typing and interest in computers. His family has said he had a bright future ahead of him.
Gov. Susana Martinez said she has met with the teens' families and they talked about what great kids they were. Both of them also had jobs.
Martinez said the families are broken but are pulling together.
"I don't think anyone ever gets over this," she said.