The man charged with carrying out a mass shooting inside a subway car in Sunset Park last year pleaded guilty in Brooklyn federal court on Tuesday.

Frank James, 63, pleaded guilty to 10 terrorism charges and one firearms-related charge Tuesday afternoon.

A federal grand jury last month charged James with 10 counts of carrying out a “terrorist attack and other violence against a mass transportation system carrying passengers,” as well as one count of discharging a firearm during a “crime of violence.”

James, who initially pleaded not guilty to one charge of a terrorist attack on a mass transit system and one firearm charge in May, faces up to 11 life sentences in connection with the attack.

He was arrested in the East Village on April 13 of last year — a day after he allegedly set off two smoke grenades and opened fire on a crowded N train as it pulled into the 36th Street station in Sunset Park during the morning rush hour.

Ten people were shot and injured during the attack, and nearly two dozen others were hurt in the panic that ensued, prosecutors said.

James evaded arrest at 36th Street by boarding an R train that had pulled into the station across the platform, according to prosecutors.

His attorneys declined comment as they walked out of court on Tuesday.