A man who opened fire on a packed Brooklyn subway train last year, wounding 10 passengers in a rush-hour attack that shocked New York City, pleaded guilty Tuesday to federal terrorism charges that could put him in prison for the rest of his life.

Frank James, 63, who posted online that he was the “Prophet of Doom,” admitted in Brooklyn federal court to pulling the trigger on a Manhattan-bound train as it moved between stations on April 12, 2022 — an assault that prosecutors said was “intended to inflict maximum damage at the height of rush hour.”

James, wearing a beige jail jumpsuit and reading from a prepared statement, said he only intended to cause serious bodily injury, not death, but that he knew his actions could have been lethal.

Dressed as a maintenance worker, James fired a 9mm handgun at least 33 times after setting off a pair of smoke grenades — wounding victims ranging in age from 16 to 60 in the legs, back, buttocks and hand as the train pulled into a station in Sunset Park. He then fled in the haze and confusion, setting off a 30-hour citywide manhunt that ended when he called the police on himself.

James pleaded guilty to all 11 counts in his indictment, including 10 counts of committing a terrorist attack against a mass transit system — one for each wounded passenger. The terrorism charge carries a maximum sentence of life in prison. The other charge — firing a firearm during a violent crime — has a mandatory minimum sentence of 10 years in prison.

Prosecutors are seeking to put him in prison for decades. His lawyers — arguing that his conduct amounted to aggravated assault, not attempted murder — said he shouldn’t serve more than 18 years. James doesn’t have a plea agreement.

In court papers, prosecutors suggested James had the means to carry out more attacks, noting that he had ammunition and other gun-related items in a Philadelphia storage unit. The New York City native had been living in Milwaukee and Philadelphia prior to the shooting.