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.