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.
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.