Richard Rojas did not speak much about his three years in a Navy uniform, but when he returned to the Bronx from a naval base in Jacksonville, Fla., in 2014, he was a different man.
His mind was clouded with conspiracy theories. His dreams of opening his own clothing business had wilted. He lashed out at friends who challenged him; some thought his grasp of reality had slipped and that he needed psychiatric help.
During a string of arrests in recent years, Mr. Rojas once threatened to kill police officers, and last week he accused a notary of trying to steal his identity and grabbed his neck, the authorities said. But through it all, friends said, he never sought or received help, instead burrowing deeper into his paranoia and drinking or smoking marijuana.
On Thursday, Mr. Rojas, 26, was behind the wheel of a car that a friend said had been outfitted with a speeding detection system after a previous drunken-driving arrest. Under a wall of billboards and bright advertisements in Times Square, he made an abrupt U-turn before plowing through three and a half blocks of sidewalk crowds, killing an 18-year-old woman, Alyssa Elsman, and hurting 22 other people, the police said.
He was taken to Bellevue Hospital Center on Thursday night for an evaluation and remained in police custody. Late Thursday, Mr. Rojas was charged with murder, attempted murder and aggravated vehicular homicide.
Under questioning by investigators after his arrest, Mr. Rojas rambled and offered different explanations for the rampage; several law enforcement officials said investigators had not yet come to any conclusions about the differing accounts. He made some statements suggesting he might have wanted to provoke the police into killing him, said the officials, who spoke on the condition of anonymity because the investigation was not complete. One of the officials said Mr. Rojas had also reported hearing voices and having hallucinations.
The police executed a search warrant on Thursday at the apartment where Mr. Rojas lived with his mother. One official said he kept Scientology books there, and another said he had made some statements about a day of reckoning.
Two of the officials said that tests showed that Mr. Rojas had not drunk alcohol but that preliminary tests indicated he had used drugs. At some point during questioning he asked for a lawyer, which ended police queries, one of the law enforcement officials said.
Mr. Rojas grew up on Walton Avenue in the Mount Eden section of the Bronx, about a mile and a half north of Yankee Stadium. With a friend, Hansel Guerrero, who lived in the same building, Mr. Rojas rode around on his bicycle and hung out at auto shops, working on people’s cars. He spoke of wanting to start a clothing line, graduate from college and have his own apartment in New York.
After taking a few college courses, Mr. Guerrero said, Mr. Rojas enlisted in the Navy in 2011. He was eager to leave the Bronx.
“He wanted really badly to be in the Navy,” Mr. Guerrero, 26, said. “To him it was a journey out of New York life. He was exploring.”
In 2012 he moved from a surface warfare officer schools unit in Great Lakes, Ill., to a naval air station in Jacksonville, Fla., and then served for six months aboard U.S.S. Carney, Navy records indicate. When he received a promotion, he would proudly text Mr. Guerrero with the news.
“To him, it was very exciting,” Mr. Guerrero said.
About a month after Mr. Rojas returned to Jacksonville, in September 2012, he was arrested just outside Naval Station Mayport and charged with battery and resisting an officer. He had told a cabdriver to follow him into the barracks where he was going to get money to pay the driver, but instead Mr. Rojas attacked him, according to an arrest report. A police officer caught him, with a torn shirt and a cut on his hand, after he drove out of the base. Mr. Rojas had been drinking, the report said.
“My life is over,” he yelled, according to the arrest report. The report said that Mr. Rojas had also threatened “to kill all police and military police he might see after he is released from jail.”
The military eventually took over prosecution of the case from the local prosecutor, said the lawyer who represented Mr. Rojas in the case, M. Alan Ceballos. The status of the case was not clear.
In May 2014, he left the Navy, records indicate. Navy officials would not disclose the circumstances of his departure, but Mr. Guerrero said Mr. Rojas told him that he had been dishonorably discharged. He had attained the rank of electrician’s mate fireman apprentice.
He began to express scorn for a government he felt had held him back and blocked his progress, Mr. Guerrero said. When Mr. Rojas returned to the Bronx apartment where his mother lived, he started drinking and grew increasingly anxious and isolated, said Harrison Ramos, 30, though other friends said that Mr. Rojas had never had a drinking problem.
“People go and they serve their country and they come back crazy and nobody helps them,” said Mr. Ramos, who said he went to William H. Taft High School with Mr. Rojas. Mr. Ramos said his friend had written conspiratorial posts online. “He seemed a little lost in the world,” he said.
An acquaintance, who declined to give his name, said he was once fixing his car after the check engine light came on, and Mr. Rojas had walked over to chat. The acquaintance said Mr. Rojas had told him that he could get the light to turn off by driving more than 100 miles per hour.
Mr. Guerrero said Mr. Rojas came to see routine government interactions as part of a plan to control him. He railed against taxes, parking tickets and police stops. He came to see his Navy training as a deception that harmed recruits, though he was rarely specific or trusting enough of his companions to explain what he meant.
“He was angry,” Mr. Guerrero said. “It was kind of hard to talk to him because it was like, if you go against him he’d see you as an enemy.”
The last time he spoke to Mr. Rojas was earlier this year, when Mr. Rojas complained that police officers judged people by their age and their skin color. “He felt like he was picked on,” Mr. Guerrero said.
His legal troubles piled up. Mr. Rojas was arrested and charged with driving while intoxicated in Manhattan in April 2015. The officer who stopped him said Mr. Rojas had watery and bloodshot eyes, slurred speech, unsteady feet and the smell of alcohol on his breath, according to a criminal complaint. It was his second drunken-driving charge in New York; the other was in 2008 in Queens. After the Manhattan episode, he pleaded guilty to an infraction and was ordered to complete a drunken-driving prevention program. His license was suspended for 90 days, and he was find $500.
A week ago, on May 11, after a man came to his mother’s apartment to notarize documents for him, Mr. Rojas grabbed the man’s neck, threatened him with a knife and said, “You’re trying to steal my identity,” according to a criminal complaint. He was charged with menacing and criminal possession of a weapon. On May 12, he pleaded guilty to harassment and was given a conditional discharge.
Another friend, Alex Ayala, 35, said he saw Mr. Rojas around that same time at the corner of Walton and East Mount Eden Avenues, where his childhood friends used to hang out. Mr. Rojas did not betray any troubles. “He was sitting on the old block,” Mr. Ayala said.