The man accused of shooting 10 people on a crowded N train last April has pleaded guilty to all 11 charges against him.

Frank Robert James, 63, admitted in a Brooklyn federal court this afternoon that he got on the rush hour train and opened fire with the intent to seriously harm people. In a statement he read to the judge, James said he didn’t want to kill anyone, but was aware that firing in an enclosed space could have done just that.

If James had been found guilty at trial, he would have faced a possible life sentence. In a letter sent to the court, prosecutors recommended a sentence of about 32 to 37 years if James accepts responsibility, or life in prison if he does not. His defense attorneys asked for a shorter sentence. The judge will make the final call and is not required to follow either of the recommendations.

James said he will make a full statement expressing his remorse when he is sentenced. That court date has not been set.

Prosecutors said James blended into the rush of morning commuters on April 12 by wearing construction gear and a mask. He set off a smoke bomb and then fired dozens of shots, hitting 10 people and sending 20 others to the hospital for injuries sustained during the chaos that followed.

Videos from the platform showed straphangers fleeing a smoke-filled train and gunshot victims lying on the ground beside puddles of blood. Although no one died, the incident heightened fears of the subway system as the city struggled to get passengers back on public transit following a major drop in ridership and a spike in crime during the pandemic.

James told Judge William F. Kuntz that he understood the potential consequences of pleading guilty, including the loss of his right to appeal. James' defense attorney said there was no viable path to defend him further in court.

James, who was dressed in khaki pants and a matching short-sleeved button-down shirt, looked intently at the judge at some moments. At other times, he looked downward, rested his chin in his palm, or clenched his fists on the table in front of him. He rubbed his eyes as the judge read the long list of counts against him and the lengthy sentence he could face.

In May, James was indicted on 10 counts of committing a terrorist attack and other violence against a mass transportation system and vehicle carrying passengers and employees, as well as one count of discharging a firearm while committing a violent crime. Authorities tracked him down the day after the shooting with help from a 21-year-old security camera installer who spotted him on the street. James initially pleaded not guilty, and his attorneys asked the courts to let him get a psychiatric evaluation. They also argued that the terrorism charges weren’t appropriate for his case.

“Mr. James has accepted responsibility for his crimes since he turned himself in to law enforcement,” said Mia Eisner-Grynberg and Amanda David, James’ federal public defenders, in a statement. “A just sentence in this case will carefully balance the harm he caused with his age, his health and the Bureau of Prisons’ notoriously inadequate medical care.”

His defense team also criticized prosecutors for seeking a sentence that they said would likely exceed his natural life.

Officials allege that multiple pieces of evidence connected James to the scene of the shooting, including the keys to the rental van he drove into the city and a bag he left behind containing fireworks, gasoline and a torch. Police also found ammunition, a Taser, a high-capacity rifle magazine and a smoke canister when they searched James' home shortly after the shooting.

Prosecutors say James used a Glock 17 pistol, which they want him to forfeit. One of the victims of the shooting, Ilene Steur, has sued the gun manufacturer under a recently passed state law that allows people to bring civil cases against the firearms industry if their products are sold or marketed in a way that poses a threat to New Yorkers’ health or safety.

The government alleges that James had been planning the attack for years, buying some items as early as 2017 and traveling to the city for a practice run. James, who grew up in the Bronx, was living in Pennsylvania at the time of the shooting.

James spoke about his desire to shoot people in a series of videos he posted to his YouTube channel. He also criticized Mayor Eric Adams for not doing more to address homelessness in the subways.

He said in court that he has been meeting with a psychologist about once a month.

Mayor Eric Adams and Gov. Kathy Hochul have both made subway safety a priority, with multiple plans rolled out in the months leading up to the mass shooting and after. The city has sent more officers onto platforms and trains, started installing cameras on every car, and directed first responders to offer services to those experiencing mental health crises and homelessness — or take them to the hospital for a psychiatric evaluation if they refuse help and cannot meet their “basic needs.”

Subway ridership is still below pre-pandemic levels, while transit crime is on the rise, according to MTA data.