Last spring, as the end of the academic year approached at Susquehanna Valley High School outside Binghamton, N.Y., students were asked for a school project about their plans after graduation.
Payton Gendron, a senior, said he wanted to commit a murder-suicide, according to a law enforcement official briefed on the matter.
He claimed to be joking, the official said. But the state police were summoned to investigate and took Mr. Gendron, then 17, into custody on June 8 under a state mental health law, police officials said Sunday. He had a psychiatric evaluation in a hospital but was released within a couple of days, the officials said. Two weeks later, Mr. Gendron graduated and fell off investigators’ radar.
On Saturday, he resurfaced 200 miles away in Buffalo, where the authorities say he opened fire at supermarket in a predominantly Black area, killing 10 people and wounding three others in one of the deadliest racist massacres in recent United States history.
After his rampage, Mr. Gendron put his gun to his neck. But two officers persuaded him to drop his weapon and surrender.
He was charged Saturday with first-degree murder, and as he awaited his fate in jail, investigators were sifting through his past to piece together how he transformed from a quiet student to an accused killer without drawing more serious scrutiny.
“There was nothing picked up on the State Police intelligence, nothing that was picked up on the F.B.I. intelligence,” Joseph A. Gramaglia, the Buffalo police commissioner, said on Sunday. “Nobody called in, nobody called any complaints.”
Steven Belongia, the special agent in charge of the F.B.I. field office in Buffalo, said that neither state nor federal investigators had any information about Mr. Gendron before his senior-year remark put him on the radar.
New York State has a so-called red flag law under which people found to be a danger can be forced to surrender their guns, but no one tried to invoke it against Mr. Gendron. The state police said he had not threatened anyone or anything in particular.
But the episode came after what former classmates said was a pattern of increasingly bizarre behavior by Mr. Gendron. Two former classmates said he showed up to class in hazmat gear after pandemic restrictions were lifted in 2020.
“He wore the entire suit, boots, gloves, everything,” Nathan Twitchell, 19, said as he stood on his porch in Binghamton, shaking his head. “Everyone was just staring at him.”
That was one of the few times students saw Mr. Gendron, said Cassaundra Williams, another student at the high school. Ms. Williams, 19, said Mr. Gendron favored online coursework even as his classmates returned to campus.
“He was always very quiet and never said much of anything,” said Ms. Williams, who added that Mr. Gendron was book smart but had grown more reclusive over the years since she met him in elementary school.
“We were just so shocked. We can’t even wrap our heads around it still,” she said.
F.B.I. agents and other law officers gathered Sunday morning outside Mr. Gendron’s family home in Conklin, a town of about 5,000 people.
There was little movement at the light-blue, two-story house with black shutters and neatly trimmed shrubs, save for agents pacing the driveway. Three neighbors stood closely together down the block, arms folded. Some recalled watching Mr. Gendron play basketball in the driveway with his two brothers, and some even had attended his front-yard graduation party last year.
Mr. Gendron’s mother did not respond to a message left on Sunday afternoon. Nor did the lawyer who represented Mr. Gendron at his arraignment, Brian Parker.
Ms. Williams said the last time she had seen Mr. Gendron was at graduation. She said she was shocked when a friend texted her after the shooting Saturday to tell her that Mr. Gendron had been arrested.
“He was just a quiet, smart kid that I wouldn’t think would be able to do anything like what he did yesterday,” said Mr. Twitchell. “It just blows my mind.”
Kolton Gardner, 18, who attended middle school and high school with Mr. Gendron, described him as “definitely a little bit of an outcast.”
“He just wasn’t that social,” Mr. Gardner said. “I knew he had an interest in guns, but where we grew up that wasn’t uncommon. That’s just kind of the thing in rural New York, people like guns.”
Mr. Gendron’s fascination with guns went beyond the casual. Law enforcement officials said he plotted the attack over several months and posted a 180-page manifesto online explaining why he committed the shootings and describing his meticulous preparations for it. In it, he wrote extensively about the pros and cons of various firearms.
The document includes a question-and-answer section, charts of data that lend a pseudoscientific air and pages of racist and anti-Semitic memes — as well as his thoughts on cryptocurrency versus fiat money and precious metals.
He wrote of his admiration for previous mass killers and said that he took as a particular inspiration the man responsible for a 2019 mosque massacre in Christchurch, New Zealand.
One of many unanswered questions posed by Mr. Gendron’s rampage is why his grim response about his post-graduation plans did not lead to further intervention beyond the mental-health exam.
Under New York State’s red flag law, enacted in 2019, anyone who believes that someone may be a threat to themselves or others can ask a judge to issue an “extreme risk protection order” that prevents the person from purchasing or possessing a firearm. The law is not used often.
The law enforcement official who had been briefed on the school project said that in New York, there are hundreds of school threats called in each year, and that in each case, authorities interview the students and their parents to determine whether students have actual access to guns. The authorities then try to make a reasoned call.
In any case, Mr. Gendron was not on any red-flag list when he entered Vintage Firearms in Endicott, N.Y., and bought the Bushmaster semiautomatic rifle that the police say he used in the shooting.
Robert Donald, the owner of the store, confirmed that his records showed he had sold the gun to Mr. Gendron, but said he did not remember the young man at all, even though he said he sells only a half-dozen or so of this type of gun in a year.
Mr. Donald, 75, who has owned the shop since 1993 and primarily sells collectible firearms, said he was shocked when federal investigators contacted him Saturday to inquire about Mr. Gendron, who Mr. Donald said had bought the gun within the last few months.
“I just can’t believe it,” he said. “I don’t understand why an 18-year-old would even do this. I know I didn’t do anything wrong, but I feel terrible about it.”
Mr. Donald said he did a background check on Mr. Gendron before he sold him the gun. The report showed nothing. “He didn’t stand out, because if he did, I would have never sold him the gun,” Mr. Donald said.
Mr. Gendron wrote that he modified the gun with his father’s power drill, using a parts kit that retails for $60. Mr. Donald said that when he sold Mr. Gendron the firearm it had complied with New York laws.
“Even with all of those safety features on it — which is the only way I sell it — any gun can be easily modified if you really want to do it,” he said.
Christine Chung, Luke Vander Ploeg and Mark Walker contributed reporting.